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 |
很无奈TLE。。。。 #include <iostream> using namespace std; __int64 c(int n,int k) { int ans = 1 , temp = 1; for(int i = k ; i >= 1 ; i --) { ans *= n-k+i; if(i % ans == 0) ans /= i; else temp *= i; } return ans/temp; } int main() { int n , k; while(scanf("%d%d",&n,&k)!=EOF) { if(!(k+n)) break; printf("%I64d\n",c(n,k)); } } 写进去就AC了 Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator