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

先对m,n排序!!然后循环较小的!!要不会TLE......

Posted by ckcz123 at 2012-07-10 18:22:16 on Problem 1942
#include <iostream>
using namespace std;

int main()
{
    long long m,n,s;
    while (cin >> m >>n && m+n!=0)
    {
        if (m==0 || n==0) {cout << "1" << endl;continue;}
        if (m>n) {long long int temp=m;m=n;n=temp;}
        s=1;
        for (long long int i=1;i<=m;i++)
            s=s*(i+n)/i;
        cout << s << 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