QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#150862#6804. Gaokaodo_while_true#AC ✓1ms3408kbC++20452b2023-08-26 14:11:242023-08-26 14:11:26

Judging History

你现在查看的是最新测评结果

  • [2023-08-26 14:11:26]
  • 评测
  • 测评结果:AC
  • 用时:1ms
  • 内存:3408kb
  • [2023-08-26 14:11:24]
  • 提交

answer

#include<iostream>
#include<cstdio>
#include<algorithm>
using namespace std;
typedef long long ll;
template<typename T>T &read(T &r){
	r=0;bool w=0;char ch=getchar();
	while(ch<'0'||ch>'9')w=ch=='-'?1:0,ch=getchar();
	while(ch>='0'&&ch<='9')r=r*10+ch-'0',ch=getchar();
	return r=w?-r:r;
}
signed main(){
	int T;read(T);
	while(T--){
		ll x;
		read(x);--x;
		int t=__builtin_popcountll(x);
		cout << (1ll<<t) << '\n';
	}
	return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 1ms
memory: 3408kb

input:

3
3
4
5

output:

2
4
2

result:

ok 3 lines

Test #2:

score: 0
Accepted
time: 0ms
memory: 3376kb

input:

500
111058001134961664
26968520849635848
509420945049900
18345473009634060
10009387904720400
297995201763124320
1199969742422880
27593767872281520
12147313869018720
228953305968050664
60157185945667200
4287882807470592
357843344256000
8916055719925032
2816902778447205
377208379246423608
928877182961...

output:

4294967296
1073741824
33554432
67108864
4294967296
134217728
134217728
67108864
1073741824
268435456
2147483648
17179869184
2147483648
68719476736
33554432
1073741824
134217728
536870912
68719476736
16777216
4294967296
17179869184
17179869184
8388608
4294967296
536870912
2147483648
1073741824
167772...

result:

ok 500 lines