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

Re:错的很诡异啊,什么原因啊?

Posted by sicheng at 2006-08-02 13:50:07 on Problem 1003
In Reply To:错的很诡异啊,什么原因啊? Posted by:chengning at 2006-07-22 02:38:07
> 
> 我把数据从小到大输入都正确,但是当我在一个小的数据之前有一个大的数据时,就会出错,好象i 就是个静态的一样,哪位大侠看看.
> 
> 
> #include<iostream.h>
> int main()
> {
> 	int i=0;
>     float m,sum=0;
>     cin>>m;
>  while(m!=0.00)
>  {
> 	 if(m<=5.20&&m>=0.01)
> 	 {
>          while(sum<=m)
> 		 {
>                i++;
>               sum+=(float)1/(i+1);
> 		 }
>          cout<<i<<" card(s)"<<endl;
> 	 }
>      cin>>m;
>  }
>  return 0;
> }
sum没初始化(多TEST CASE) 以后要注意INITIATION

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