QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#36213 | #4286. 99 Problems | cheems_is_hiring | WA | 3ms | 3648kb | C++ | 851b | 2022-06-26 00:04:24 | 2022-06-26 00:04:25 |
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;
int dis = 999999 , ans = -1;
for(int 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: 0
Wrong Answer
time: 3ms
memory: 3648kb
input:
10
output:
9
result:
wrong answer 1st lines differ - expected: '99', found: '9'