From 031765e9a0b92ec5e940cb9ada5699c0b5ec4134 Mon Sep 17 00:00:00 2001 From: Ren Baoshuo Date: Sat, 18 Sep 2021 19:53:15 +0800 Subject: [PATCH] =?UTF-8?q?3972.=20=E6=96=B9=E6=A0=BC=E9=9B=86=E6=95=B0?= =?UTF-8?q?=E9=87=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit https://www.acwing.com/problem/content/submission/code_detail/7800351/ --- AcWing/3972/3972.cpp | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 AcWing/3972/3972.cpp diff --git a/AcWing/3972/3972.cpp b/AcWing/3972/3972.cpp new file mode 100644 index 00000000..a0110726 --- /dev/null +++ b/AcWing/3972/3972.cpp @@ -0,0 +1,32 @@ +#include + +using namespace std; + +int n, m, f[2][55]; +long long ans; +bool g[55][55]; + +int main() { + cin >> n >> m; + for (int i = 1; i <= n; i++) { + for (int j = 1; j <= m; j++) { + cin >> g[i][j]; + } + } + for (int i = 1; i <= n; i++) { + for (int j = 1; j <= m; j++) { + f[0][i] += g[i][j]; + f[1][j] += g[i][j]; + } + } + for (int i = 1; i <= n; i++) { + ans += (long long)pow(2, f[0][i]) - 1; + ans += (long long)pow(2, m - f[0][i]) - 1; + } + for (int i = 1; i <= m; i++) { + ans += (long long)pow(2, f[1][i]) - 1; + ans += (long long)pow(2, n - f[1][i]) - 1; + } + cout << ans - n * m << endl; + return 0; +}