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

## 求大神鉴定诡异代码、、、几乎一样的代码，一个T，一个A

Posted by justryit at 2013-09-19 16:11:35 on Problem 1942 and last updated at 2013-09-19 16:13:58
```Source Code

Problem: 1942		User: justryit
Memory: N/A		Time: N/A
Language: C++		Result: Time Limit Exceeded
Source Code
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<string>
#include<cmath>
#include<queue>
#include<algorithm>
#include<iostream>
using namespace std;
unsigned c(unsigned n,unsigned m)
{
unsigned a=m;
unsigned b=n;
double cnm=1.0;
while(b>0)
cnm*=(double)(a--)/(double)(b--);
cnm+=0.5;
return (unsigned)cnm;
}
int main()
{
int n=0,m=0;
while(scanf("%d%d",&n,&m),!(n==0 && m==0))
{
}
return 0;
}

Source Code

Problem: 1942		User: justryit
Memory: 176K		Time: 0MS
Language: C++		Result: Accepted
Source Code
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<string>
#include<cmath>
#include<queue>
#include<algorithm>
#include<iostream>
using namespace std;
unsigned c(unsigned n,unsigned m)
{
unsigned a=m+n;
unsigned b=min(n,m);
double cnm=1.0;
while(b>0)
cnm*=(double)(a--)/(double)(b--);
cnm+=0.5;
return (unsigned)cnm;
}
int main()
{
int n=0,m=0;
while(scanf("%d%d",&n,&m),!(n==0 && m==0))
{
printf("%u\n",c(n,m));
}
return 0;
}

Followed by: