QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#133850#6262. Jazz it Up!KhNURE_KIVI#AC ✓1ms3632kbC++232.2kb2023-08-02 15:39:282023-08-02 15:39:30

Judging History

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

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2023-08-02 15:39:30]
  • 评测
  • 测评结果:AC
  • 用时:1ms
  • 内存:3632kb
  • [2023-08-02 15:39:28]
  • 提交

answer

//#pragma GCC optimize("Ofast", "unroll-loops")
//#pragma GCC target("sse", "sse2", "sse3", "ssse3", "sse4")

#ifdef __APPLE__

#include <iostream>
#include <cmath>
#include <algorithm>
#include <stdio.h>
#include <cstdint>
#include <cstring>
#include <string>
#include <cstdlib>
#include <vector>
#include <bitset>
#include <map>
#include <queue>
#include <ctime>
#include <stack>
#include <set>
#include <list>
#include <random>
#include <deque>
#include <functional>
#include <iomanip>
#include <sstream>
#include <fstream>
#include <complex>
#include <numeric>
#include <cassert>
#include <array>
#include <tuple>
#include <unordered_map>
#include <unordered_set>
#include <thread>

#else
#include <bits/stdc++.h>
#endif

#define all(a) a.begin(),a.end()
#define len(a) (int)(a.size())
#define mp make_pair
#define pb push_back
#define fir first
#define sec second
#define fi first
#define se second

using namespace std;

typedef pair<int, int> pii;
typedef long long ll;
typedef long double ld;

template<typename T>
bool umin(T &a, T b) {
    if (b < a) {
        a = b;
        return true;
    }
    return false;
}

template<typename T>
bool umax(T &a, T b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}

#if __APPLE__
#define D for (bool _FLAG = true; _FLAG; _FLAG = false)
#define LOG(...) print(#__VA_ARGS__" ::", __VA_ARGS__) << endl

template<class ...Ts>
auto &print(Ts ...ts) { return ((cerr << ts << " "), ...); }

#else
#define D while (false)
#define LOG(...)
#endif

const int max_n = -1, inf = 1000111222;

//mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

bool good(ll x) {
    for(ll i = 2; i * i <= x; i++)
        if(x % (i * i) == 0) return false;
    return true;
}

void solve() {
    ll n;
    cin >> n;
    for(ll m = 2; m < n; m++)
        if(good(n * m)) {
            cout << m << '\n';
            break;
        }
}

signed main() {
//   freopen("input.txt", "r", stdin);
//   freopen("output.txt", "w", stdout);

    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);

    int t = 1;

    //cin >> t;

    while (t--) solve();

}

/*
KIVI
*/

详细

Test #1:

score: 100
Accepted
time: 1ms
memory: 3528kb

input:

3

output:

2

result:

ok correct

Test #2:

score: 0
Accepted
time: 1ms
memory: 3416kb

input:

30

output:

7

result:

ok correct

Test #3:

score: 0
Accepted
time: 1ms
memory: 3480kb

input:

13

output:

2

result:

ok correct

Test #4:

score: 0
Accepted
time: 0ms
memory: 3460kb

input:

11

output:

2

result:

ok correct

Test #5:

score: 0
Accepted
time: 1ms
memory: 3460kb

input:

13

output:

2

result:

ok correct

Test #6:

score: 0
Accepted
time: 1ms
memory: 3420kb

input:

14

output:

3

result:

ok correct

Test #7:

score: 0
Accepted
time: 1ms
memory: 3464kb

input:

3

output:

2

result:

ok correct

Test #8:

score: 0
Accepted
time: 0ms
memory: 3416kb

input:

30030

output:

17

result:

ok correct

Test #9:

score: 0
Accepted
time: 0ms
memory: 3368kb

input:

5

output:

2

result:

ok correct

Test #10:

score: 0
Accepted
time: 1ms
memory: 3532kb

input:

6

output:

5

result:

ok correct

Test #11:

score: 0
Accepted
time: 1ms
memory: 3412kb

input:

7

output:

2

result:

ok correct

Test #12:

score: 0
Accepted
time: 1ms
memory: 3412kb

input:

8633

output:

2

result:

ok correct

Test #13:

score: 0
Accepted
time: 1ms
memory: 3632kb

input:

89

output:

2

result:

ok correct

Test #14:

score: 0
Accepted
time: 1ms
memory: 3460kb

input:

9026

output:

3

result:

ok correct

Test #15:

score: 0
Accepted
time: 1ms
memory: 3460kb

input:

9217

output:

2

result:

ok correct

Test #16:

score: 0
Accepted
time: 1ms
memory: 3456kb

input:

9410

output:

3

result:

ok correct

Test #17:

score: 0
Accepted
time: 1ms
memory: 3484kb

input:

9605

output:

2

result:

ok correct

Test #18:

score: 0
Accepted
time: 0ms
memory: 3480kb

input:

99929

output:

2

result:

ok correct

Test #19:

score: 0
Accepted
time: 1ms
memory: 3460kb

input:

99961

output:

2

result:

ok correct

Test #20:

score: 0
Accepted
time: 1ms
memory: 3480kb

input:

99971

output:

2

result:

ok correct

Test #21:

score: 0
Accepted
time: 1ms
memory: 3452kb

input:

99989

output:

2

result:

ok correct

Test #22:

score: 0
Accepted
time: 1ms
memory: 3628kb

input:

99991

output:

2

result:

ok correct

Test #23:

score: 0
Accepted
time: 1ms
memory: 3476kb

input:

96331

output:

2

result:

ok correct

Test #24:

score: 0
Accepted
time: 1ms
memory: 3624kb

input:

24213

output:

2

result:

ok correct

Test #25:

score: 0
Accepted
time: 1ms
memory: 3420kb

input:

52259

output:

2

result:

ok correct

Test #26:

score: 0
Accepted
time: 1ms
memory: 3464kb

input:

99123

output:

2

result:

ok correct

Test #27:

score: 0
Accepted
time: 1ms
memory: 3456kb

input:

43498

output:

3

result:

ok correct

Test #28:

score: 0
Accepted
time: 0ms
memory: 3592kb

input:

97589

output:

2

result:

ok correct

Test #29:

score: 0
Accepted
time: 1ms
memory: 3460kb

input:

30030

output:

17

result:

ok correct

Test #30:

score: 0
Accepted
time: 1ms
memory: 3456kb

input:

11663

output:

2

result:

ok correct

Test #31:

score: 0
Accepted
time: 1ms
memory: 3460kb

input:

14351

output:

2

result:

ok correct

Test #32:

score: 0
Accepted
time: 0ms
memory: 3456kb

input:

17947

output:

2

result:

ok correct

Test #33:

score: 0
Accepted
time: 1ms
memory: 3624kb

input:

20711

output:

2

result:

ok correct

Test #34:

score: 0
Accepted
time: 1ms
memory: 3464kb

input:

23707

output:

2

result:

ok correct

Test #35:

score: 0
Accepted
time: 1ms
memory: 3464kb

input:

27221

output:

2

result:

ok correct

Test #36:

score: 0
Accepted
time: 1ms
memory: 3416kb

input:

30967

output:

2

result:

ok correct

Test #37:

score: 0
Accepted
time: 1ms
memory: 3476kb

input:

34571

output:

2

result:

ok correct

Test #38:

score: 0
Accepted
time: 0ms
memory: 3592kb

input:

38021

output:

2

result:

ok correct

Test #39:

score: 0
Accepted
time: 1ms
memory: 3460kb

input:

199

output:

2

result:

ok correct

Test #40:

score: 0
Accepted
time: 1ms
memory: 3532kb

input:

7429

output:

2

result:

ok correct

Test #41:

score: 0
Accepted
time: 1ms
memory: 3412kb

input:

33263

output:

2

result:

ok correct

Test #42:

score: 0
Accepted
time: 0ms
memory: 3460kb

input:

82861

output:

2

result:

ok correct

Test #43:

score: 0
Accepted
time: 1ms
memory: 3368kb

input:

3127

output:

2

result:

ok correct

Test #44:

score: 0
Accepted
time: 1ms
memory: 3592kb

input:

4087

output:

2

result:

ok correct

Test #45:

score: 0
Accepted
time: 1ms
memory: 3528kb

input:

5183

output:

2

result:

ok correct

Test #46:

score: 0
Accepted
time: 1ms
memory: 3460kb

input:

6557

output:

2

result:

ok correct

Test #47:

score: 0
Accepted
time: 1ms
memory: 3628kb

input:

8633

output:

2

result:

ok correct

Test #48:

score: 0
Accepted
time: 1ms
memory: 3376kb

input:

10403

output:

2

result:

ok correct

Test #49:

score: 0
Accepted
time: 1ms
memory: 3412kb

input:

85263

output:

2

result:

ok correct

Test #50:

score: 0
Accepted
time: 0ms
memory: 3588kb

input:

84101

output:

2

result:

ok correct