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:谁能帮我看看为何会Compile Error ?且点进去后只有"Compile Error"字样而没有告诉你怎么错?

Posted by mayunfeng at 2010-01-21 00:39:36 on Problem 2453
In Reply To:谁能帮我看看为何会Compile Error ?且点进去后只有"Compile Error"字样而没有告诉你怎么错? Posted by:weilun at 2010-01-21 00:26:21
> #include <iostream>
> #include <cmath>
> using namespace std;
> 
> int main()
> {
>     int k,n,zero,one,a[1000];
> 	double ans;
> 	while(cin>>k&&k)
> 	{
> 	        ans=k;
> 		for(n=0;k;++n)
> 		{
> 			a[n+1]=k%2;
> 			k/=2;
> 		}
> 
> 		zero=0;
> 		one=0;
> 		while(!a[++zero]);
>                 zero--;
> 		one=zero;
> 		while(a[++one]&&one<=n);
> 		one--;
> 
> 		ans+=pow(2.0,zero);
> 		ans+=pow(2.0,one-zero-1)-1;
> 		cout<<ans<<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