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 |
为什么是错误的答案?各位高手可以指点一二么?我的代码如下;测试数据是对的,可提交就是不对! #include<stdio.h> int main() { int n,k,i; scanf("%d%d",&n,&k); while(1) { long int result=1; if(n==0&&k==0) break; else if((n==k)||(k==0)) printf("1\n"); else { if(k>n/2) k=n-k; for(i=1;i<=k;i++) { result=result*n; n--; result=result/i; } printf("%d\n",result); } scanf("%d%d",&n,&k); } return 0; } Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator