QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#36218#4286. 99 Problemscheems_is_hiringWA 2ms3752kbC++936b2022-06-26 00:08:332022-06-26 00:08:34

Judging History

你现在查看的是最新测评结果

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2022-06-26 00:08:34]
  • 评测
  • 测评结果:WA
  • 用时:2ms
  • 内存:3752kb
  • [2022-06-26 00:08:33]
  • 提交

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'