QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#232018#7055. A Hard ProblemRonbogo#WA 7ms3700kbC++20909b2023-10-29 19:10:022023-10-29 19:10:02

Judging History

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

  • [2023-10-29 19:10:02]
  • 评测
  • 测评结果:WA
  • 用时:7ms
  • 内存:3700kb
  • [2023-10-29 19:10:02]
  • 提交

answer

#include <iostream>
#include <sstream>
#include <cstdio>
#include <cstring>
#include <string>
#include <cmath>
#include <algorithm>
#include <set>
#include <queue>
#include <stack>
#include <map>
#include <unordered_map>
#include <vector>
#define INF 0x3f3f3f3f
#define debug(x) std::cout<<#x<<":"<<x<<endl
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef double db;
const int N=1e6;

signed main() {
    #ifndef ONLINE_JUDGE
        freopen("/Users/holden/Desktop/code/cin.in", "r", stdin);
        freopen("/Users/holden/Desktop/code/cout.out", "w", stdout);
    #endif

    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int t;
    cin >> t;
    while (t--) {
        ll x;
        cin >> x;
        ll q = sqrt(x);
        if (q * q < x) {
            q++;
        }
        cout << min(q + 1, x) << '\n';
    }
    return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 0ms
memory: 3700kb

input:

4
2
3
4
5

output:

2
3
3
4

result:

ok 4 lines

Test #2:

score: -100
Wrong Answer
time: 7ms
memory: 3640kb

input:

100000
6
18
54
162
486
1458
4374
13122
39366
118098
354294
1062882
3188646
9565938
28697814
86093442
258280326
774840978
324522916
973568748
920706226
762118660
286355962
859067886
577203640
731610911
194832715
584498145
753494426
260483260
781449780
344349322
33047957
99143871
297431613
892294839
6...

output:

4
6
9
14
24
40
68
116
200
345
597
1032
1787
3094
5359
9280
16073
27837
18016
31204
30345
27608
16924
29311
24027
27050
13960
24178
27451
16141
27956
18558
5750
9959
17248
29873
26019
5538
9591
16611
28770
21977
21186
18613
6259
10840
18774
7569
13109
22704
23372
25270
30258
27320
15459
26776
12271
2...

result:

wrong answer 2nd lines differ - expected: '10', found: '6'