记录编号 | 85826 | 评测结果 | AAAAAAAAAA | ||
---|---|---|---|---|---|
题目名称 | 1474.[UVa 11538] 象棋中的皇后 | 最终得分 | 100 | ||
用户昵称 | 是否通过 | 通过 | |||
代码语言 | C++ | 运行时间 | 0.003 s | ||
提交时间 | 2014-01-13 18:45:20 | 内存使用 | 0.31 MiB | ||
#include<iostream> #include<cstdio> using namespace std; long long math(long long n,long long m) { long long t,ans; if(n>m) { t=m; m=n; n=t; } ans=(n*(n-1)*m+m*(m-1)*n+2*n*(n-1)*(m-n+1)+2*n*(n-1)*(2*n-4)/3); return ans; } int main() { freopen("chessqueen.in","r",stdin); freopen("chessqueen.out","w",stdout); string s; long long x,y; /*while(cin>>s) { cin>>x>>y; cout<<s<<endl; cout<<math(x,y)<<endl; } */ cin>>x>>y; cout<<math(x,y); return 0; }