Submission #534434
Source Code Expand
#include <stdio.h>
int bitscnt(long long int num){
int res = 0;
for(;num != 0;num&=num-1)
res++;
return res;
}
int main(){
long long int lli,tmp;
int n,i,s,t;
scanf("%d",&n);
for(i=0;i<n;i++){
scanf("%lld",&lli);
for(tmp=1;tmp<=lli;tmp++){
s = bitscnt(tmp);
t = bitscnt(lli+tmp);
if(s == t){
printf("%d\n",tmp);
break;
}
}
}
return 0;
}
Submission Info
| Submission Time | |
|---|---|
| Task | H - Bit Count |
| User | niconico774 |
| Language | C (GCC 4.9.2) |
| Score | 0 |
| Code Size | 404 Byte |
| Status | TLE |
| Exec Time | 2033 ms |
| Memory | 808 KiB |
Compile Error
./Main.c: In function ‘main’:
./Main.c:21:5: warning: format ‘%d’ expects argument of type ‘int’, but argument 2 has type ‘long long int’ [-Wformat=]
printf("%d\n",tmp);
^
./Main.c:14:2: warning: ignoring return value of ‘scanf’, declared with attribute warn_unused_result [-Wunused-result]
scanf("%d",&n);
^
./Main.c:16:3: warning: ignoring return value of ‘scanf’, declared with attribute warn_unused_result [-Wunused-result]
scanf("%lld",&lli);
^
Judge Result
| Set Name | All | ||||
|---|---|---|---|---|---|
| Score / Max Score | 0 / 300 | ||||
| Status |
|
| Set Name | Test Cases |
|---|---|
| All | 00_sample.txt, 10_small_00.txt, 20_medium_01.txt, 20_medium_02.txt, 20_medium_03.txt, 30_large_04.txt, 30_large_05.txt, 30_large_06.txt, 80_power_of_2.txt |
| Case Name | Status | Exec Time | Memory |
|---|---|---|---|
| 00_sample.txt | AC | 26 ms | 796 KiB |
| 10_small_00.txt | AC | 21 ms | 704 KiB |
| 20_medium_01.txt | AC | 33 ms | 800 KiB |
| 20_medium_02.txt | AC | 42 ms | 784 KiB |
| 20_medium_03.txt | AC | 41 ms | 800 KiB |
| 30_large_04.txt | TLE | 2033 ms | 796 KiB |
| 30_large_05.txt | TLE | 2033 ms | 808 KiB |
| 30_large_06.txt | TLE | 2033 ms | 800 KiB |
| 80_power_of_2.txt | TLE | 2033 ms | 720 KiB |