ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#214955 | #3855. 好数 | Maple | 0 | 29ms | 1188kb | C++ | 477b | 2024-11-24 12:35:07 | 2024-11-24 13:16:14 |
answer
#include<iostream>
#include<cstdio>
using namespace std;
int q;
int f(int y){
int p=1;
int x=y;
while(x){
x&=x-1;
p<<=1;
}
return p;
}
int main(){
//freopen("ex_number3.in","r",stdin);
scanf("%d",&q);
for(int i=1;i<=q;i++){
int l,r;
int t=0;
scanf("%d%d",&l,&r);
for(int j=l;j<=r;j++){
int k=f(j);
if(j%k==0&&(j/k)%2==1){
printf("%d\n",j);
t=1;
break;
}
}
if(!t)printf("%d\n",-1);
}
return 0;
}
详细
小提示:点击横条可展开更详细的信息
Subtask #1:
score: 0
Time Limit Exceeded
Test #1:
score: 30
Accepted
time: 0ms
memory: 1188kb
input:
1 999995700 1000000000
output:
-1
result:
ok Accepted! >_<
Test #2:
score: -30
Time Limit Exceeded
input:
100000 7857167 7862247 8344618 8348655 8382478 8388566 8315927 8321011 8246290 8250342 8382480 83885...
output:
-1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 8370176 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1...
result:
Subtask #2:
score: 0
Time Limit Exceeded
Test #13:
score: 30
Accepted
time: 29ms
memory: 1188kb
input:
100000 8382464 8388612 7332864 7337984 8250368 8255488 8119296 8124416 8373248 8378368 8348672 83537...
output:
8382464 7332864 8250368 8119296 8373248 8348672 8315904 4187136 8246272 8311808 8344576 6280192 4174...
result:
ok Accepted! >_<
Test #14:
score: -30
Time Limit Exceeded
input:
100000 330807594 855120061 2739043 698283851 6893055 483485075 87223028 335275196 436165546 84345741...
output:
330813440 2739456 6893696 87223296 436166656 184620160 878068224 321856512 421955072 518016000 16218...
result:
Subtask #3:
score: 0
Skipped