Skip to content

AtCoder/ABC059 #306

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Jan 5, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions atcoder/abc059/A/main.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#include <bits/stdc++.h>

using namespace std;
using ll = long long;

int main() {
ios_base::sync_with_stdio(false);
cin.tie(0); cout.tie(0);

string s1, s2, s3;
cin >> s1 >> s2 >> s3;
cout << (char)toupper(s1[0]) << (char)toupper(s2[0]) << (char)toupper(s3[0]) << endl;

return 0;
}
23 changes: 23 additions & 0 deletions atcoder/abc059/B/main.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#include <bits/stdc++.h>

using namespace std;
using ll = long long;

int main() {
ios_base::sync_with_stdio(false);
cin.tie(0); cout.tie(0);

string A, B;
cin >> A >> B;
int NA = A.size(), NB = B.size();

if (NA > NB || (NA == NB && A > B)) {
cout << "GREATER" << endl;
} else if (NA < NB || (NA == NB && A < B)) {
cout << "LESS" << endl;
} else {
cout << "EQUAL" << endl;
}

return 0;
}
38 changes: 38 additions & 0 deletions atcoder/abc059/C/main.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
#include <bits/stdc++.h>

using namespace std;
using ll = long long;

int N;
vector<int> A;

ll solve(int sign) {
assert(sign == 1 || sign == -1);
ll ans = 0;
ll sum = 0;
for (int i = 0; i < N; ++i) {
sum += A[i];
int c1 = (sign == 1 && sum <= 0) ? -sum + 1 : 0;
int c2 = (sign == -1 && sum >= 0) ? sum + 1 : 0;
assert(c1 >= 0 && c2 >= 0);
sum += c1 + -c2;
sign *= -1;
ans += c1 + c2;
}
return ans;
}

int main() {
ios_base::sync_with_stdio(false);
cin.tie(0); cout.tie(0);

cin >> N;
A.assign(N, 0);
for (int i = 0; i < N; ++i) {
cin >> A[i];
}

cout << min(solve(1), solve(-1)) << endl;

return 0;
}
2 changes: 2 additions & 0 deletions atcoder/abc059/C/sample1.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
2
0 2
2 changes: 2 additions & 0 deletions atcoder/abc059/C/sample2.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
2
0 -2
2 changes: 2 additions & 0 deletions atcoder/abc059/C/sample3.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
3
0 2 -2
20 changes: 20 additions & 0 deletions atcoder/abc059/D/main.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#include <bits/stdc++.h>

using namespace std;
using ll = long long;

string solve(ll X, ll Y) {
ll Z = abs(X - Y);
return Z <= 1 ? "Brown" : "Alice";
}

int main() {
ios_base::sync_with_stdio(false);
cin.tie(0); cout.tie(0);

ll X, Y;
cin >> X >> Y;
cout << solve(X, Y) << endl;

return 0;
}