QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#275900 | #5259. Skills in Pills | wangqingxian | TL | 1ms | 3704kb | C++14 | 278b | 2023-12-05 11:12:20 | 2023-12-05 11:12:21 |
Judging History
answer
#include<bits/stdc++.h>
using namespace std;
int a,b,n,g[1000001],i;
int f(int x,int y){i=min(x,y);return (x>n&&y>n)?0:(x!=y)?f((x<y)?x+a:x,(x>y)?y+b:y)+1:(g[i]>=0)?g[i]:g[i]=min(f(x-1+a,y),f(x,y-1+b))+1;}
int main(){cin>>a>>b>>n;fill(g+1,g+1+n,-1);cout<<f(a,b);return 0;}
詳細信息
Test #1:
score: 100
Accepted
time: 1ms
memory: 3696kb
input:
3 9 20
output:
8
result:
ok single line: '8'
Test #2:
score: 0
Accepted
time: 0ms
memory: 3636kb
input:
8 2 12
output:
7
result:
ok single line: '7'
Test #3:
score: 0
Accepted
time: 0ms
memory: 3640kb
input:
2 5 15
output:
10
result:
ok single line: '10'
Test #4:
score: 0
Accepted
time: 0ms
memory: 3632kb
input:
10 8 13
output:
2
result:
ok single line: '2'
Test #5:
score: 0
Accepted
time: 0ms
memory: 3704kb
input:
6 6 19
output:
6
result:
ok single line: '6'
Test #6:
score: 0
Accepted
time: 0ms
memory: 3636kb
input:
2 3 5
output:
3
result:
ok single line: '3'
Test #7:
score: 0
Accepted
time: 0ms
memory: 3632kb
input:
4 2 8
output:
6
result:
ok single line: '6'
Test #8:
score: 0
Accepted
time: 0ms
memory: 3576kb
input:
5 5 5
output:
2
result:
ok single line: '2'
Test #9:
score: 0
Accepted
time: 0ms
memory: 3632kb
input:
3 8 11
output:
4
result:
ok single line: '4'
Test #10:
score: 0
Accepted
time: 0ms
memory: 3640kb
input:
5 8 16
output:
5
result:
ok single line: '5'
Test #11:
score: 0
Accepted
time: 0ms
memory: 3636kb
input:
9 7 279
output:
70
result:
ok single line: '70'
Test #12:
score: 0
Accepted
time: 0ms
memory: 3616kb
input:
8 3 56
output:
25
result:
ok single line: '25'
Test #13:
score: 0
Accepted
time: 0ms
memory: 3612kb
input:
5 9 46
output:
14
result:
ok single line: '14'
Test #14:
score: 0
Accepted
time: 0ms
memory: 3636kb
input:
8 4 251
output:
93
result:
ok single line: '93'
Test #15:
score: 0
Accepted
time: 0ms
memory: 3636kb
input:
8 7 41
output:
10
result:
ok single line: '10'
Test #16:
score: 0
Accepted
time: 0ms
memory: 3696kb
input:
60 17 360
output:
27
result:
ok single line: '27'
Test #17:
score: 0
Accepted
time: 0ms
memory: 3620kb
input:
16 55 388
output:
31
result:
ok single line: '31'
Test #18:
score: 0
Accepted
time: 0ms
memory: 3564kb
input:
25 38 292
output:
18
result:
ok single line: '18'
Test #19:
score: 0
Accepted
time: 0ms
memory: 3564kb
input:
22 59 177
output:
11
result:
ok single line: '11'
Test #20:
score: 0
Accepted
time: 1ms
memory: 3608kb
input:
4 3 82
output:
50
result:
ok single line: '50'
Test #21:
score: -100
Time Limit Exceeded
input:
77 18 511543