标签:style color os io for ar line amp
间隔着取_(:зゝ∠)_
#include <iostream> #include <cstdio> #include <algorithm> using namespace std; typedef long long ll; int n, m; int init(int i, int j) { int cnt = 1; if(i-1 >= 1) cnt *= 2; if(i+1 <= n) cnt *= 2; if(j-1 >= 1) cnt *= 2; if(j+1 <= m) cnt *= 2; return cnt; } int main() { int T; scanf("%d", &T); while(T-- > 0) { scanf("%d%d", &n, &m); if(n == 1 && m == 1) { cout << 1 << endl; continue; } ll ans = 0; for(int i = 1; i <= n; i ++) { for(int j = 1+(i&1); j <= m; j += 2) { ans += init(i, j); } } cout << ans << endl; } return 0; }
HDU 4925 Apple Tree 找呀找规律,布布扣,bubuko.com
标签:style color os io for ar line amp
原文地址:http://blog.csdn.net/qq574857122/article/details/38427249