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 |
我的纯暴力程序难道也WA?In Reply To:看看为什么wa,跟ac程序对拍都没问题 Posted by:2008__ at 2008-08-07 22:52:14 #include<iostream> using namespace std; int main() { int ans,l,r,i,j,judge,a,b; while(cin>>l>>r){ ans=0; for(i=l;i<=r;++i) { a=b=0; j=i; while(j){ if(j&1){ ++a; }else ++b; j>>=1; } if(a<=b) ++ans; } cout<<ans<<endl; } return 0; } 用此程序测试数据 1 2000000000 输出937891981 跟我写的程序一样啊,WHY WA? Followed by:
Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator