Skip to content

Commit d10caf9

Browse files
authored
add tests (#321)
1 parent 172fded commit d10caf9

File tree

2 files changed

+35
-0
lines changed

2 files changed

+35
-0
lines changed

number/test/is_prime.test.cpp

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
#define PROBLEM "https://judge.yosupo.jp/problem/primality_test"
2+
#include "../factorize.hpp"
3+
4+
#include <iostream>
5+
using namespace std;
6+
7+
int main() {
8+
cin.tie(nullptr);
9+
ios_base::sync_with_stdio(false);
10+
11+
int Q;
12+
cin >> Q;
13+
while (Q--) {
14+
unsigned long long N;
15+
cin >> N;
16+
cout << (is_prime(N) ? "Yes" : "No") << '\n';
17+
}
18+
}

string/test/lyndon.test.cpp

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
#define PROBLEM "https://judge.yosupo.jp/problem/lyndon_factorization"
2+
#include "../lyndon.hpp"
3+
4+
#include <iostream>
5+
#include <string>
6+
using namespace std;
7+
8+
int main() {
9+
cin.tie(nullptr);
10+
ios_base::sync_with_stdio(false);
11+
12+
string S;
13+
cin >> S;
14+
auto ret = lyndon_factorization(S);
15+
for (auto [l, len] : ret) cout << l << ' ';
16+
cout << S.size() << '\n';
17+
}

0 commit comments

Comments
 (0)