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 arcane at 2005-06-10 10:17:40 on Problem 1003
#include <iostream.h>
#include <iomanip.h>
void  main()
{
 int count=0;
 long n;
 long b;
 long* array=&b;
 do {float a;
	 cin>>setprecision(3)>>a;
     cout<<"\n";
	 n=1;
	 if(a!=0.00)
	 { if(a>=0.01&&a<=5.20)
	 {while(a>0){
		 n=n+1;
		 a=a-(1.0/n);}
	     n=n-1;
	     array[count]=n;
	     count++;
		}
	    else
		  return;
	 }
	    else
		 break;
	}while(true);
int i=0;
for(;i<count;i++)
cout<<array[i]<<"\n";
}

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