QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#36218 | #4286. 99 Problems | cheems_is_hiring | WA | 2ms | 3752kb | C++ | 936b | 2022-06-26 00:08:33 | 2022-06-26 00:08:34 |
Judging History
answer
/******************************************************************************
Online C++ Compiler.
Code, Compile, Run and Debug C++ program online.
Write your code in this editor and press "Run" button to compile and execute it.
*******************************************************************************/
#include <iostream>
#include <bits/stdc++.h>
using namespace std;
int main()
{
set<int> A;
for(int i = 1; i <= 10 ; i ++) {
for(int j = 1 ; j <= 4 ; j ++) {
A.insert( i * (pow(10,j)) -1);
}
}
int a; cin >> a;
if(a <= 99) {
cout << 99 << endl; return 0;
}
int dis = 999999 , ans = -1;
for(int x : A ) {
if(x >= a)
if(abs(x - a) < dis) {
dis = abs(x - a);
ans = x;
}
}
cout << ans << endl;
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 2ms
memory: 3660kb
input:
10
output:
99
result:
ok single line: '99'
Test #2:
score: 0
Accepted
time: 0ms
memory: 3708kb
input:
249
output:
299
result:
ok single line: '299'
Test #3:
score: -100
Wrong Answer
time: 0ms
memory: 3752kb
input:
10000
output:
19999
result:
wrong answer 1st lines differ - expected: '9999', found: '19999'