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 <iostream> using namespace std; int main() { double i; double a[100]; int j = 0; cin>>i; while(i != 0.00) { if(i>0.01&&i<=5.20) a[j++] = i; cin>>i; } int m=0; int b[100]; double sum=0,k=0; for(k=a[m];m<j;) for(int n=2;n<277;n++) { sum += 1.0/n; if(sum>=k&&k>=1){ b[m++]=n-1; sum = 0; k = a[m]; break; } if(a[m]<1){ b[m++] = 1; sum = 0; k = a[m]; break; } } int l=0; while(l<=m-1) cout<<b[l++]<<"card(s)"<<endl; return 0; } Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator