| ||||||||||
| 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:我的纯暴力程序难道也WA?In Reply To:我的纯暴力程序难道也WA? Posted by:CydorniaKnight at 2008-11-07 15:39:41 > #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