| ||||||||||
| Online Judge | Problem Set | Authors | Online Contests | User | ||||||
|---|---|---|---|---|---|---|---|---|---|---|
| Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest | |||||||||
谁做了uva的H,能帮我看看怎么Wa了? 我依次累加最小外接矩形为a*b的三角形的个数。我依次累加最小外接矩形为a*b的三角形的个数。
#include <stdio.h>
#include <iostream.h>
#include <memory.h>
long long m,n,r,c,k;
int main(int argc, char* argv[])
{
long long t=0;
while (cin>>m>>n&&!(m==0&&n==0))
{
t++;
r=n+1;
c=m+1;
k=0;
for (m=2;m<=c;m++)
for (n=2;n<=r;n++)
k+=(c-m+1)*(r-n+1)*((m-2)*(n-2)*4+6*(m+n-4)+4);
// printf("%lld",k);
cout<<"Case "<<t<<": "<<k<<endl;
}
return 0;
}
Followed by:
Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator