Problem 1476 矩形的个数. 思路 找规律:f(a,b) = (1+2+3+……+a) × (1+2+3+……+b) = (1+a)×a/2 * (1+b)×b/2 笔记 用GUN C++ WA,用VC++ AC……我决定回头测一下以前通过的题了 代码 #include<cstdio> using namespace std; int main(){ long long a, b; long long ans; while(scanf("%lld%lld", &a, &b)!=EOF){ ans = (1+a)*a/2 * (1+b)*b/2; printf("%lld\n", ans); } return 0; }