QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#72107 | #4184. Amusement Arcade | ricky0129 | WA | 2ms | 3520kb | C++14 | 837b | 2023-01-14 01:14:04 | 2023-01-14 01:14:05 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define vi vector<int>
#define pii pair<int,int>
#define pll pair<ll,ll>
#define vll vector<ll>
#define FOR(i,n) for(int i=0;i<n;i++)
#define rep(i, a, b) for(int i = a; i < (b); ++i)
#define all(x) begin(x), end(x)
#define sz(x) (int)(x).size()
#define pb push_back
#define f first
#define s second
const int MOD = (int)1e9+7;
int main()
{
ll x;
cin>>x;
if(x<=3){
cout<<1<<endl;
return 0;
}
ll d = (x+1)/2;
ll dist;
if(d%2==1){
dist = x-1;
}
else{
dist = x-3;
}
int bits =0;
FOR(i,61){
if(dist&(1LL<<i)) bits++;
}
if(bits!=1) cout<<"impossible\n";
else if(d%2==1) cout<<1<<endl;
else cout<<3<<endl;
return 0;
}
详细
Test #1:
score: 100
Accepted
time: 0ms
memory: 3288kb
input:
7
output:
3
result:
ok
Test #2:
score: 0
Accepted
time: 2ms
memory: 3520kb
input:
15
output:
impossible
result:
ok
Test #3:
score: 0
Accepted
time: 0ms
memory: 3336kb
input:
19
output:
3
result:
ok
Test #4:
score: 0
Accepted
time: 2ms
memory: 3232kb
input:
2049
output:
1
result:
ok
Test #5:
score: 0
Accepted
time: 2ms
memory: 3484kb
input:
32769
output:
1
result:
ok
Test #6:
score: 0
Accepted
time: 2ms
memory: 3332kb
input:
536870913
output:
1
result:
ok
Test #7:
score: 0
Accepted
time: 2ms
memory: 3344kb
input:
35184372088833
output:
1
result:
ok
Test #8:
score: 0
Accepted
time: 2ms
memory: 3292kb
input:
2251799813685249
output:
1
result:
ok
Test #9:
score: 0
Accepted
time: 0ms
memory: 3480kb
input:
576460752303423489
output:
1
result:
ok
Test #10:
score: 0
Accepted
time: 2ms
memory: 3520kb
input:
1027
output:
3
result:
ok
Test #11:
score: -100
Wrong Answer
time: 2ms
memory: 3468kb
input:
2081
output:
impossible
result:
wrong output format Expected integer, but "impossible" found