QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#689096#6607. Rise of Shadowsbright_mlTL 1ms3704kbC++11878b2024-10-30 15:17:552024-10-30 15:18:06

Judging History

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

  • [2024-10-30 15:18:06]
  • 评测
  • 测评结果:TL
  • 用时:1ms
  • 内存:3704kb
  • [2024-10-30 15:17:55]
  • 提交

answer

//
// Created by 35395 on 2024/10/30.
//
#include<bits/stdc++.h>
#define int register long long
using namespace std;

void solve() {
    int h,m,a;
    cin >> h >> m >> a;
    int ans = 0;
    int x = h * m + m - 1 - a;
    int y = h * m - a;
    int z = (h-1) * m;
    int p = m - a - 1;
    for(int r=0;r<m;r++){
        int down = ((h - 1) * r + p) / m, up = ((h-1) * r + a) / m;
        down = max(0ll,down), up = min(h-1,up);
        ans += up - down + 1;
        if((h-1) * r + y <= z){
            ans += (h - 1) - ((h-1) * r + x) / m + 1;
        }
        if((h-1) * r - y >= 0){
            ans += ((h-1) * r - y) / m + 1;
        }
    }
    cout << ans << '\n';
}

signed main() {
    ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
    int test = 1;
//    cin >> test;
    while (test--) {
        solve();
    }
    return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 0ms
memory: 3696kb

input:

5 5 4

output:

9

result:

ok 1 number(s): "9"

Test #2:

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

input:

3 5 1

output:

3

result:

ok 1 number(s): "3"

Test #3:

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

input:

5 5 0

output:

1

result:

ok 1 number(s): "1"

Test #4:

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

input:

5 5 1

output:

3

result:

ok 1 number(s): "3"

Test #5:

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

input:

5 5 2

output:

5

result:

ok 1 number(s): "5"

Test #6:

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

input:

5 5 3

output:

7

result:

ok 1 number(s): "7"

Test #7:

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

input:

5 5 5

output:

11

result:

ok 1 number(s): "11"

Test #8:

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

input:

5 5 6

output:

13

result:

ok 1 number(s): "13"

Test #9:

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

input:

5 5 7

output:

15

result:

ok 1 number(s): "15"

Test #10:

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

input:

5 5 8

output:

17

result:

ok 1 number(s): "17"

Test #11:

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

input:

5 5 9

output:

19

result:

ok 1 number(s): "19"

Test #12:

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

input:

5 5 10

output:

21

result:

ok 1 number(s): "21"

Test #13:

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

input:

5 5 11

output:

23

result:

ok 1 number(s): "23"

Test #14:

score: -100
Time Limit Exceeded

input:

628383665 981360590 38277030565242771

output:


result: