QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#55203#1752. Ballpark EstimateMostafa_Moharram#AC ✓2ms3724kbC++17452b2022-10-12 18:30:032022-10-12 18:30:03

Judging History

This is the latest submission verdict.

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2022-10-12 18:30:03]
  • Judged
  • Verdict: AC
  • Time: 2ms
  • Memory: 3724kb
  • [2022-10-12 18:30:03]
  • Submitted

answer

#include <bits/stdc++.h>

using namespace std;

using ll = long long;

int main() {
    ios::sync_with_stdio(false); cout.tie(nullptr); cin.tie(nullptr);
    ll n; cin >> n;
    string s = to_string(n);
    ll one = 1;
    for (int i = 1; i < s.size(); ++i)
        s[i] = '0', one *= 10;
    ll number = stoll(s, nullptr, 10);
    if (n - number >= number + one - n)
        number += one;
    cout << number << '\n';
    return 0;
}

详细

Test #1:

score: 100
Accepted
time: 2ms
memory: 3552kb

input:

1

output:

1

result:

ok single line: '1'

Test #2:

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

input:

533839461958894364

output:

500000000000000000

result:

ok single line: '500000000000000000'

Test #3:

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

input:

253879280762610326

output:

300000000000000000

result:

ok single line: '300000000000000000'

Test #4:

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

input:

861411989833943880

output:

900000000000000000

result:

ok single line: '900000000000000000'

Test #5:

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

input:

5

output:

5

result:

ok single line: '5'

Test #6:

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

input:

9

output:

9

result:

ok single line: '9'

Test #7:

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

input:

11

output:

10

result:

ok single line: '10'

Test #8:

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

input:

15

output:

20

result:

ok single line: '20'

Test #9:

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

input:

49

output:

50

result:

ok single line: '50'

Test #10:

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

input:

1497

output:

1000

result:

ok single line: '1000'

Test #11:

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

input:

6583

output:

7000

result:

ok single line: '7000'

Test #12:

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

input:

8967

output:

9000

result:

ok single line: '9000'

Test #13:

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

input:

9758

output:

10000

result:

ok single line: '10000'

Test #14:

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

input:

10772

output:

10000

result:

ok single line: '10000'

Test #15:

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

input:

11644

output:

10000

result:

ok single line: '10000'

Test #16:

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

input:

20851

output:

20000

result:

ok single line: '20000'

Test #17:

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

input:

21166

output:

20000

result:

ok single line: '20000'

Test #18:

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

input:

24183

output:

20000

result:

ok single line: '20000'

Test #19:

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

input:

28860

output:

30000

result:

ok single line: '30000'

Test #20:

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

input:

32184

output:

30000

result:

ok single line: '30000'

Test #21:

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

input:

32325

output:

30000

result:

ok single line: '30000'