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 |
关于这题目的答案输出这题的输出让我很困惑。doube result,直接用c++的cout<<result<<endl是wa(改成cout<<int(result)<<endl还是wa)。改成c的printf("%.0lf\n",result)就对了。代码很简单就是组合数。哪位大牛指点下? #include<iostream> using namespace std; int main() { double i; double col,row,sum,result,temp; while(cin>>col>>row){ if(row+col==0)return 0; result=1; sum=row+col; if(col<row){ temp=col; col=row; row=temp; } for(i=col+1;i<=sum;i+=1) result*=(i/(i-col)); printf("%.0lf\n",result); } } Followed by:
Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator