ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#214954 | #3855. 好数 | Maple | Compile Error | / | / | C++ | 462b | 2024-11-24 12:34:05 | 2024-11-24 13:16:12 |
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);
}
详细
answer.code: In function 'int main()': answer.code:31:2: error: expected '}' at end of input }\x0d ^ answer.code:17:16: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result] scanf("%d",&q);\x0d ^ answer.code:21:22: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result] scanf("%d%d",&l,&r);\x0d ^