-
Notifications
You must be signed in to change notification settings - Fork 814
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
🎉 GPLT L1-081 to L1-096, L2-041 to L2-048
- Loading branch information
Showing
24 changed files
with
501 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
#include <iostream> | ||
using namespace std; | ||
int main() { | ||
cout << "I'm gonna win! Today!\n2022-04-23"; | ||
return 0; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
#include <iostream> | ||
using namespace std; | ||
int N, v; | ||
int main() { | ||
cin >> N >> v; | ||
cout << N / v; | ||
return 0; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
#include <iostream> | ||
using namespace std; | ||
int prohibit, accompany, q1, q2; | ||
int main() { | ||
cin >> prohibit >> accompany >> q1 >> q2; | ||
cout << q1 << '-'; | ||
if (q1 >= prohibit && q2 >= prohibit) cout << "Y " << q2 << "-Y\nhuan ying ru guan"; | ||
else if (q1 < prohibit && q2 < prohibit) cout << "N " << q2 << "-N\nzhang da zai lai ba"; | ||
else if (q1 >= accompany) cout << "Y " << q2 << "-Y\nqing 1 zhao gu hao 2"; | ||
else if (q2 >= accompany) cout << "Y " << q2 << "-Y\nqing 2 zhao gu hao 1"; | ||
else if (q1 >= prohibit) cout << "Y " << q2 << "-N\n1: huan ying ru guan"; | ||
else cout << "N " << q2 << "-Y\n2: huan ying ru guan"; | ||
return 0; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
#include <iostream> | ||
using namespace std; | ||
int A, B, C = 1; | ||
int main() { | ||
cin >> A >> B; | ||
for (int i = 1; i <= A + B; i++) { | ||
C *= i; | ||
} | ||
cout << C; | ||
return 0; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
#include <iostream> | ||
using namespace std; | ||
int n, dice[6]; | ||
int main() { | ||
for (int i = 0; i < 6; i++) cin >> dice[i]; | ||
cin >> n; | ||
for (int i = 0; i < 6; i++) { | ||
if (i) cout << ' '; | ||
if (dice[i] >= 7 - n) cout << 6 - n; | ||
else cout << 7 - n; | ||
} | ||
return 0; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
#include <iostream> | ||
using namespace std; | ||
string s, a, S = "", A = ""; | ||
int main() { | ||
cin >> s >> a; | ||
for (int i = 1; i < s.size(); i++) { | ||
if (s[i] % 2 == s[i - 1] % 2) S += max(s[i], s[i - 1]); | ||
} | ||
for (int i = 1; i < a.size(); i++) { | ||
if (a[i] % 2 == a[i - 1] % 2) A += max(a[i], a[i - 1]); | ||
} | ||
cout << S; | ||
if (S != A) cout << '\n' << A; | ||
return 0; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
#include <iostream> | ||
using namespace std; | ||
int N, M, Q, T, C, Num_C, Num_R, Column[100001], Row[100001]; | ||
int main() { | ||
cin >> N >> M >> Q; | ||
for (int i = 0; i < Q; i++) { | ||
cin >> T >> C; | ||
if (T && !Column[C]) { | ||
Column[C] = 1; | ||
++Num_C; | ||
} else if (!T && !Row[C]) { | ||
Row[C] = 1; | ||
++Num_R; | ||
} | ||
} | ||
cout << N * M - Num_C * N - Num_R * M + Num_C * Num_R; | ||
return 0; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
#include <iostream> | ||
using namespace std; | ||
int N, K, S, ans, score_gplt, score_pat, mark[10001]; | ||
int main() { | ||
cin >> N >> K >> S; | ||
for (int i = 0; i < N; i++) { | ||
cin >> score_gplt >> score_pat; | ||
if (score_gplt >= 175) { | ||
if (score_pat >= S) ++ans; | ||
else if (mark[score_gplt] < K) { | ||
ans++; | ||
mark[score_gplt]++; | ||
} | ||
} | ||
} | ||
cout << ans; | ||
return 0; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
#include <iostream> | ||
using namespace std; | ||
int main() { | ||
cout << "Good code is its own best documentation."; | ||
return 0; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
#include <iostream> | ||
using namespace std; | ||
int main() { | ||
int a, b; | ||
cin >> a >> b; | ||
cout << a + b - 16 << '\n' << a + b - 3 << '\n' << a + b - 1 << '\n' << a + b; | ||
return 0; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
#include <iostream> | ||
using namespace std; | ||
int main() { | ||
int N, M, K; | ||
string X; | ||
cin >> N >> X >> M >> K; | ||
if (K == N) cout << "mei you mai " << X << " de"; | ||
else if (K == M) cout << "kan dao le mai " << X << " de"; | ||
else cout << "wang le zhao mai " << X << " de"; | ||
return 0; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
#include <iostream> | ||
using namespace std; | ||
int main() { | ||
int N, A, B, C; | ||
cin >> N; | ||
while(N--) { | ||
cin >> A >> B >> C; | ||
if (C == A * B) cout << "Lv Yan\n"; | ||
else if (C == A + B) cout << "Tu Dou\n"; | ||
else cout << "zhe du shi sha ya!\n"; | ||
} | ||
return 0; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
#include <iostream> | ||
using namespace std; | ||
int Hat[105], Guess, Right, Wrong, N, K; | ||
int main() { | ||
cin >> N; | ||
for (int i = 1; i <= N; i++) cin >> Hat[i]; | ||
cin >> K; | ||
while(K--) { | ||
Right = Wrong = 0; | ||
for (int i = 1; i <= N; i++) { | ||
cin >> Guess; | ||
if (Guess && Guess == Hat[i]) Right = 1; | ||
else if (Guess && Guess != Hat[i]) Wrong = 1; | ||
} | ||
if (Wrong || !Right) cout << "Ai Ya\n"; | ||
else cout << "Da Jiang!!!\n"; | ||
} | ||
return 0; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
#include <iostream> | ||
#include <string> | ||
using namespace std; | ||
string s, a, b, X; | ||
int N, l, r, pos; | ||
int main() { | ||
cin >> s >> N; | ||
while (N--) { | ||
cin >> l >> r >> a >> b; | ||
X = s.substr(l - 1, r - l + 1); | ||
s.erase(l - 1, r - l + 1); | ||
pos = s.find(a + b); | ||
if (pos == -1) s = s + X; | ||
else { | ||
s = s.substr(0, pos + (int)a.size()) + X + s.substr(pos + (int)a.size()); | ||
} | ||
} | ||
cout << s; | ||
return 0; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
#include <iostream> | ||
using namespace std; | ||
int n0, n1, n, F, M; | ||
int main() { | ||
cin >> n0 >> n1 >> n; | ||
for (int i = 2; i <= n0; i++) { | ||
if (n0 % i != 0 || n0 / i > n) continue; | ||
int j = n - n0 / i; | ||
if (n1 % j != 0) continue; | ||
if (!F || abs(i - n1 / j) < abs(n0 / F - n1 / M)) { | ||
F = n0 / i, M = j; | ||
} | ||
} | ||
if (F) cout << F << ' ' << M; | ||
else cout << "No Solution"; | ||
return 0; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
#include <iostream> | ||
#include <string> | ||
#include <algorithm> | ||
using namespace std; | ||
int N, a, b; | ||
string A, B; | ||
int main() { | ||
cin >> N; | ||
while(N--) { | ||
cin >> A >> B; | ||
a = b = 0; | ||
for (auto it : A) { | ||
a += it - '0'; | ||
} | ||
for (auto it : B) { | ||
b += it - '0'; | ||
} | ||
if (stoi(A) % b == 0 && stoi(B) % a != 0) cout << "A\n"; | ||
else if (stoi(A) % b != 0 && stoi(B) % a == 0) cout << "B\n"; | ||
else if (stoi(A) > stoi(B)) cout << "A\n"; | ||
else cout << "B\n"; | ||
} | ||
return 0; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
#include <iostream> | ||
#include <stack> | ||
#include <vector> | ||
using namespace std; | ||
int N, M, K, tui; | ||
stack<int> he; | ||
vector<int> temp; | ||
void outprint() { | ||
for (int i = 0; i < temp.size(); i++) { | ||
if (i) cout << ' '; | ||
cout << temp[i]; | ||
} | ||
cout << '\n'; | ||
temp.clear(); | ||
} | ||
int main() { | ||
cin >> N >> M >> K; | ||
for (int i = 0; i < N; i++) { | ||
cin >> tui; | ||
tuihaimeiyong: | ||
while (!he.empty()) { | ||
if (temp.empty() || he.top() <= temp.back()) { | ||
temp.push_back(he.top()); | ||
he.pop(); | ||
} | ||
else break; | ||
if (temp.size() == K) outprint(); | ||
} | ||
if (temp.empty() || tui <= temp.back()) temp.push_back(tui); | ||
else if(he.size() < M) he.push(tui); | ||
else { | ||
outprint(); | ||
goto tuihaimeiyong; | ||
} | ||
if (temp.size() == K) outprint(); | ||
} | ||
while(!he.empty()) { | ||
if (temp.empty() || he.top() <= temp.back()) { | ||
temp.push_back(he.top()); | ||
he.pop(); | ||
} | ||
else outprint(); | ||
if (temp.size() == K) outprint(); | ||
} | ||
for (int j = 0; j < temp.size(); j++) { | ||
if (j) cout << ' '; | ||
cout << temp[j]; | ||
} | ||
return 0; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
#include <iostream> | ||
#include <set> | ||
using namespace std; | ||
set<pair<string, string> > record; | ||
string work_start_time, work_end_time, last_start = "00:00:00"; | ||
int main() { | ||
cin >> work_start_time; | ||
while (cin >> work_start_time >> work_end_time >> work_end_time) record.insert({work_start_time, work_end_time}); | ||
record.insert({"23:59:59", ""}); | ||
for (auto ite : record) { | ||
if (last_start < ite.first) cout << last_start << " - " << ite.first << '\n'; | ||
last_start = ite.second; | ||
} | ||
return 0; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
#include <iostream> | ||
#include <queue> | ||
using namespace std; | ||
int N, M, Parent_num, new_address, passed_close_to_root, Round, Longest_path, Parent[100001], mark[100001], Distance[100001]; | ||
vector<int> Child[100001]; | ||
queue<pair<int, int> > Q; | ||
int main() { | ||
cin >> N >> M; | ||
for (int i = 1; i <= N; i++) { | ||
cin >> Parent_num; | ||
if (Parent_num < 0) Parent[0] = i; | ||
else Child[Parent_num].push_back(i); | ||
Parent[i] = Parent_num; | ||
} | ||
mark[Parent[0]] = 1; | ||
Q.push({Parent[0], 0}); | ||
while(!Q.empty()) { | ||
int id = Q.front().first, deep = Q.front().second; | ||
Q.pop(); | ||
Distance[id] = deep; | ||
for (auto ite : Child[id]) Q.push({ite, deep + 1}); | ||
} | ||
for (int i = 0; i < M; i++) { | ||
cin >> new_address; | ||
passed_close_to_root = new_address; | ||
while(!mark[passed_close_to_root]) { | ||
mark[passed_close_to_root] = 1; | ||
passed_close_to_root = Parent[passed_close_to_root]; | ||
} | ||
Round += Distance[new_address] - Distance[passed_close_to_root]; | ||
Longest_path = max(Longest_path, Distance[new_address]); | ||
cout << Round * 2 - Longest_path * 1 << '\n'; | ||
} | ||
return 0; | ||
} |
Oops, something went wrong.