QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#594142#9354. Justifying the ConjectureNatalia#TL 0ms3556kbC++23760b2024-09-27 19:38:192024-09-27 19:38:19

Judging History

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

  • [2024-09-27 19:38:19]
  • 评测
  • 测评结果:TL
  • 用时:0ms
  • 内存:3556kb
  • [2024-09-27 19:38:19]
  • 提交

answer

#include <bits/stdc++.h>
using namespace std;
#define endl '\n'
#define int long long

int T, n;

bool prime(int n)
{
    if(n<=1)
        return 0;
    for (int i = 2; i * i <= n; ++i)
    {
        if (n % i == 0)
            return 0;
    }
    return 1;
}

void solve()
{
    std::cin >> n;
    for (int i = 2; i <= n; ++i)
    {
        if (prime(i)==0 && prime(n - i)==1)
        {
            std::cout << n-i << " " << i << endl;
            return;
        }
    }
    std::cout << "-1" << endl;
    return;
}

signed main()
{
    std::ios_base::sync_with_stdio(0);
    std::cin.tie(nullptr);
    std::cout.tie(nullptr);

    std::cin >> T;
    while (T--)
    {
        solve();
    }

    return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

input:

3
4
6
7

output:

-1
2 4
3 4

result:

ok ok

Test #2:

score: -100
Time Limit Exceeded

input:

100000
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
8...

output:

-1
-1
-1
-1
-1
2 4
3 4
2 6
5 4
2 8
7 4
3 9
7 6
5 9
11 4
7 9
13 4
3 15
13 6
11 9
17 4
13 9
19 4
3 21
19 6
17 9
23 4
19 9
23 6
5 25
23 8
23 9
29 4
19 15
31 4
11 25
31 6
29 9
31 8
31 9
37 4
17 25
37 6
29 15
41 4
37 9
43 4
23 25
43 6
41 9
47 4
43 9
47 6
29 25
47 8
47 9
53 4
43 15
53 6
11 49
53 8
53 9
59...

result: