QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#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;
}
詳細信息
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'