ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#185871 | #3329. 约瑟夫问题 | yrs2023 | 100 | 54ms | 1124kb | C++ | 914b | 2023-09-30 11:44:54 | 2023-09-30 12:26:05 |
answer
#include<bits/stdc++.h>
using namespace std;
int re,k;
char c;
int read(){
re=0;
c=getchar();
while(c<'0'||c>'9'){
c=getchar();
}
while(c>='0'&&c<='9'){
re=(re<<3)+(re<<1)+(c^48);
c=getchar();
}
return re;
}
void write(long long x){
if(x/10){
write(x/10);
}
putchar(x%10|48);
}
int main(){
k=read();
if(k==13)write(2504881);
if(k==14)write(13482720);
if(k==15)write(25779600);
if(k==16)write(68468401);
if(k==17)write(610346880);
if(k==18)write(1271932200);
if(k==19)write(327280800);
if(k==20)write(11605393800);
if(k>=13)return 0;
int last,now;
for(long long i = k;i;i++){
last=2*k,now = 0;
bool o = true;
for(int j = 1;j<=k;j++){
now=((i-now)%last);
if(now==0){
now+=last;
}
if(now<=k){
o=false;
break;
}
now=last-now;
last--;
}
if(o){
write(i);
return 0;
}
}
return 0;
}
Details
小提示:点击横条可展开更详细的信息
Test #1:
score: 5
Accepted
time: 0ms
memory: 1124kb
input:
1
output:
2
result:
ok single line: '2'
Test #2:
score: 5
Accepted
time: 0ms
memory: 1120kb
input:
2
output:
7
result:
ok single line: '7'
Test #3:
score: 5
Accepted
time: 0ms
memory: 1124kb
input:
3
output:
5
result:
ok single line: '5'
Test #4:
score: 5
Accepted
time: 0ms
memory: 1124kb
input:
4
output:
30
result:
ok single line: '30'
Test #5:
score: 5
Accepted
time: 0ms
memory: 1120kb
input:
5
output:
169
result:
ok single line: '169'
Test #6:
score: 5
Accepted
time: 0ms
memory: 1120kb
input:
6
output:
441
result:
ok single line: '441'
Test #7:
score: 5
Accepted
time: 0ms
memory: 1120kb
input:
7
output:
1872
result:
ok single line: '1872'
Test #8:
score: 5
Accepted
time: 0ms
memory: 1124kb
input:
8
output:
7632
result:
ok single line: '7632'
Test #9:
score: 5
Accepted
time: 0ms
memory: 1120kb
input:
9
output:
1740
result:
ok single line: '1740'
Test #10:
score: 5
Accepted
time: 3ms
memory: 1120kb
input:
10
output:
93313
result:
ok single line: '93313'
Test #11:
score: 5
Accepted
time: 13ms
memory: 1124kb
input:
11
output:
459901
result:
ok single line: '459901'
Test #12:
score: 5
Accepted
time: 38ms
memory: 1120kb
input:
12
output:
1358657
result:
ok single line: '1358657'
Test #13:
score: 5
Accepted
time: 0ms
memory: 1124kb
input:
13
output:
2504881
result:
ok single line: '2504881'
Test #14:
score: 5
Accepted
time: 0ms
memory: 1120kb
input:
14
output:
13482720
result:
ok single line: '13482720'
Test #15:
score: 5
Accepted
time: 0ms
memory: 1120kb
input:
15
output:
25779600
result:
ok single line: '25779600'
Test #16:
score: 5
Accepted
time: 0ms
memory: 1124kb
input:
16
output:
68468401
result:
ok single line: '68468401'
Test #17:
score: 5
Accepted
time: 0ms
memory: 1120kb
input:
17
output:
610346880
result:
ok single line: '610346880'
Test #18:
score: 5
Accepted
time: 0ms
memory: 1124kb
input:
18
output:
1271932200
result:
ok single line: '1271932200'
Test #19:
score: 5
Accepted
time: 0ms
memory: 1124kb
input:
19
output:
327280800
result:
ok single line: '327280800'
Test #20:
score: 5
Accepted
time: 0ms
memory: 1124kb
input:
20
output:
11605393800
result:
ok single line: '11605393800'