QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#36213#4286. 99 Problemscheems_is_hiringWA 3ms3648kbC++851b2022-06-26 00:04:242022-06-26 00:04:25

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:04:25]
  • 评测
  • 测评结果:WA
  • 用时:3ms
  • 内存:3648kb
  • [2022-06-26 00:04:24]
  • 提交

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;
}

详细

Test #1:

score: 0
Wrong Answer
time: 3ms
memory: 3648kb

input:

10

output:

9

result:

wrong answer 1st lines differ - expected: '99', found: '9'