QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#55119#1752. Ballpark EstimateBeevo#AC ✓2ms3708kbC++23659b2022-10-12 12:21:012022-10-12 12:21: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 12:21:03]
  • Judged
  • Verdict: AC
  • Time: 2ms
  • Memory: 3708kb
  • [2022-10-12 12:21:01]
  • Submitted

answer

#include <bits/stdc++.h>

#define el '\n'
#define ll long long
#define ld long double

#define Beevo ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);

using namespace std;

void testCase() {
    ll n;
    cin >> n;

    string s = to_string(n);

    for (int i = 1; i < s.size(); i++)
        s[i] = '0';

    ll a = stoll(s);

    ll b = a, p = 1;

    for (int i = 0; i < s.size() - 1; i++)
        p *= 10;

    b += p;

    if (b - n <= n - a)
        cout << b;
    else
        cout << a;
}

signed main() {
    Beevo

    int T = 1;
//    cin >> T;

    while (T--)
        testCase();

    return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

input:

1

output:

1

result:

ok single line: '1'

Test #2:

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

input:

533839461958894364

output:

500000000000000000

result:

ok single line: '500000000000000000'

Test #3:

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

input:

253879280762610326

output:

300000000000000000

result:

ok single line: '300000000000000000'

Test #4:

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

input:

861411989833943880

output:

900000000000000000

result:

ok single line: '900000000000000000'

Test #5:

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

input:

5

output:

5

result:

ok single line: '5'

Test #6:

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

input:

9

output:

9

result:

ok single line: '9'

Test #7:

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

input:

11

output:

10

result:

ok single line: '10'

Test #8:

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

input:

15

output:

20

result:

ok single line: '20'

Test #9:

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

input:

49

output:

50

result:

ok single line: '50'

Test #10:

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

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: 2ms
memory: 3632kb

input:

8967

output:

9000

result:

ok single line: '9000'

Test #13:

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

input:

9758

output:

10000

result:

ok single line: '10000'

Test #14:

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

input:

10772

output:

10000

result:

ok single line: '10000'

Test #15:

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

input:

11644

output:

10000

result:

ok single line: '10000'

Test #16:

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

input:

20851

output:

20000

result:

ok single line: '20000'

Test #17:

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

input:

21166

output:

20000

result:

ok single line: '20000'

Test #18:

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

input:

24183

output:

20000

result:

ok single line: '20000'

Test #19:

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

input:

28860

output:

30000

result:

ok single line: '30000'

Test #20:

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

input:

32184

output:

30000

result:

ok single line: '30000'

Test #21:

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

input:

32325

output:

30000

result:

ok single line: '30000'