Online JudgeProblem SetAuthorsOnline ContestsUser
Web Board
Home Page
F.A.Qs
Statistical Charts
Problems
Submit Problem
Online Status
Prob.ID:
Register
Update your info
Authors ranklist
Current Contest
Past Contests
Scheduled Contests
Award Contest
User ID:
Password:
  Register

谁做了uva的H,能帮我看看怎么Wa了? 我依次累加最小外接矩形为a*b的三角形的个数。

Posted by Lucifer at 2005-09-23 22:09:59
我依次累加最小外接矩形为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:
User ID:
Password:
Title:

Content:

Home Page   Go Back  To top


All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator