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

结果都出来怎么错误呢?大牛解答一下吧,谢谢

Posted by dengjin at 2009-01-18 14:14:36 on Problem 1003
#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:
User ID:
Password:
Title:

Content:

Home Page   Go Back  To top


All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator