| ||||||||||
| 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 | |||||||||
Re:谁能帮我看看为何会Compile Error ?且点进去后只有"Compile Error"字样而没有告诉你怎么错?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: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator