-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtestExample.cpp
More file actions
109 lines (99 loc) · 1.97 KB
/
testExample.cpp
File metadata and controls
109 lines (99 loc) · 1.97 KB
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
101
102
103
104
105
106
107
108
109
#include "testlib.h"
#include <stdio.h>
#include <iostream>
#include <vector>
#include <string>
#include <map>
#include <unordered_map>
#include <set>
#include <unordered_set>
#include <algorithm>
#include <cmath>
#include <cstring>
#include <queue>
#include <list>
using namespace std;
using ll = long long;
#define pb push_back
#define f first
#define se second
#define ve vector
#define FOR(i, a, b) for (int i = a; i < b; ++i)
#define RFOR(i, a, b) for (int i = a; i >= b; i--)
// Some predefined templates
template <typename T>
ostream &operator<<(ostream &out, const vector<T> &a)
{
out << "[";
bool first = true;
for (auto v : a)
{
out << (first ? "" : ", ");
out << v;
first = 0;
}
out << "]";
return out;
}
template <typename U, typename T, class Cmp>
ostream &operator<<(ostream &out, const map<U, T, Cmp> &a)
{
out << "{";
bool first = true;
for (auto &p : a)
{
out << (first ? "" : ", ");
out << p.first << ":" << p.second;
first = 0;
}
out << "}";
return out;
}
template <typename U, typename T, class Cmp>
ostream &operator<<(ostream &out, const unordered_map<U, T, Cmp> &a)
{
out << "{";
bool first = true;
for (auto &p : a)
{
out << (first ? "" : ", ");
out << p.first << ":" << p.second;
first = 0;
}
out << "}";
return out;
}
ll gcd(ll x, ll y)
{
return (y == 0 ? x : gcd(y, x % y));
}
ll lcm(ll x, ll y)
{
return x * y / gcd(x, y);
}
int to_int(string &s)
{
int res = 0;
for (char c : s)
{
res = res * 10 + (c - '0');
}
return res;
}
int MOD = 998244353;
int mod = 998244353;
int INF = INT_MAX;
int main(int argc, char * argv[])
{
setName("compare two signed int%d's", 8 * int(sizeof(int)));
registerTestlibCmd(argc, argv);
int x = inf.readInt();
int y = ouf.readInt();
if(y <= 0) {
quitf(_wa, ": expect a positive number");
}
int g = __gcd(x, y);
if (g != 1)
quitf(_wa, ": %d and %d are not co-prime", x, y);
quitf(_ok, "");
}