QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#135665#5259. Skills in Pillsviniciuslettieri#WA 2ms3600kbC++201.4kb2023-08-05 20:55:472023-08-05 20:55:51

Judging History

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

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2023-08-05 20:55:51]
  • 评测
  • 测评结果:WA
  • 用时:2ms
  • 内存:3600kb
  • [2023-08-05 20:55:47]
  • 提交

answer

#include <bits/stdc++.h>

using namespace std;
using lint = int64_t;
int main() {
    cin.tie(nullptr)->sync_with_stdio(false);
    int a, b, n;
    cin>>a>>b>>n;
    if(a > b) swap(a, b);
    bool ok = true;
    {
        lint na = -1, nb = -1;
        for(int i=0;i<b;i++){
            lint cnt = 1 + lint(i) * a;
            if(cnt % b == 0){
                nb = b * lint(cnt - 1);
            }
        }
        for(int i=0;i<a;i++){
            lint cnt = 1 + lint(i) * b;
            if(cnt % a == 0){
                na = a * lint(cnt - 1);
            }
        }
        if(nb < na) ok = false;
    }
    int ca = 0, cb = 0;
    int ans = 0;
    int ra = n % a, rb = n % b;
    for(int i=0;i<n;i++){
        ca++, cb++;
        if(i + 1 < n && ca + 1 == a && cb + 1 == b){
            if(ra + 1 < a){
                ra++;
                ca = 0;
                ans++;
            }
            else if(rb + 1 < b){
                rb++;
                cb = 0;
                ans++;
            }
            else if(ok){
                ca = 0;
                ans++;
            }
            else{
                cb = 0;
                ans++;
            }
        }
        else if(ca == a){
            ca = 0;
            ans++;
        }
        else if(cb == b){
            cb = 0;
            ans++;
        }
    }
    cout<<ans<<"\n";
    return 0;
}

詳細信息

Test #1:

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

input:

3 9 20

output:

8

result:

ok single line: '8'

Test #2:

score: 0
Accepted
time: 1ms
memory: 3380kb

input:

8 2 12

output:

7

result:

ok single line: '7'

Test #3:

score: 0
Accepted
time: 1ms
memory: 3468kb

input:

2 5 15

output:

10

result:

ok single line: '10'

Test #4:

score: 0
Accepted
time: 1ms
memory: 3460kb

input:

10 8 13

output:

2

result:

ok single line: '2'

Test #5:

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

input:

6 6 19

output:

6

result:

ok single line: '6'

Test #6:

score: 0
Accepted
time: 1ms
memory: 3480kb

input:

2 3 5

output:

3

result:

ok single line: '3'

Test #7:

score: 0
Accepted
time: 2ms
memory: 3484kb

input:

4 2 8

output:

6

result:

ok single line: '6'

Test #8:

score: 0
Accepted
time: 1ms
memory: 3464kb

input:

5 5 5

output:

2

result:

ok single line: '2'

Test #9:

score: 0
Accepted
time: 1ms
memory: 3468kb

input:

3 8 11

output:

4

result:

ok single line: '4'

Test #10:

score: 0
Accepted
time: 1ms
memory: 3468kb

input:

5 8 16

output:

5

result:

ok single line: '5'

Test #11:

score: 0
Accepted
time: 1ms
memory: 3460kb

input:

9 7 279

output:

70

result:

ok single line: '70'

Test #12:

score: 0
Accepted
time: 1ms
memory: 3456kb

input:

8 3 56

output:

25

result:

ok single line: '25'

Test #13:

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

input:

5 9 46

output:

14

result:

ok single line: '14'

Test #14:

score: 0
Accepted
time: 1ms
memory: 3372kb

input:

8 4 251

output:

93

result:

ok single line: '93'

Test #15:

score: 0
Accepted
time: 1ms
memory: 3472kb

input:

8 7 41

output:

10

result:

ok single line: '10'

Test #16:

score: 0
Accepted
time: 1ms
memory: 3488kb

input:

60 17 360

output:

27

result:

ok single line: '27'

Test #17:

score: 0
Accepted
time: 1ms
memory: 3424kb

input:

16 55 388

output:

31

result:

ok single line: '31'

Test #18:

score: 0
Accepted
time: 1ms
memory: 3416kb

input:

25 38 292

output:

18

result:

ok single line: '18'

Test #19:

score: 0
Accepted
time: 1ms
memory: 3468kb

input:

22 59 177

output:

11

result:

ok single line: '11'

Test #20:

score: -100
Wrong Answer
time: 1ms
memory: 3460kb

input:

4 3 82

output:

52

result:

wrong answer 1st lines differ - expected: '50', found: '52'