diff --git a/atcoder/abc059/A/main.cpp b/atcoder/abc059/A/main.cpp new file mode 100644 index 00000000..11b0db8c --- /dev/null +++ b/atcoder/abc059/A/main.cpp @@ -0,0 +1,15 @@ +#include + +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; +} \ No newline at end of file diff --git a/atcoder/abc059/B/main.cpp b/atcoder/abc059/B/main.cpp new file mode 100644 index 00000000..5d09845d --- /dev/null +++ b/atcoder/abc059/B/main.cpp @@ -0,0 +1,23 @@ +#include + +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; +} \ No newline at end of file diff --git a/atcoder/abc059/C/main.cpp b/atcoder/abc059/C/main.cpp new file mode 100644 index 00000000..423fafbf --- /dev/null +++ b/atcoder/abc059/C/main.cpp @@ -0,0 +1,38 @@ +#include + +using namespace std; +using ll = long long; + +int N; +vector 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; +} \ No newline at end of file diff --git a/atcoder/abc059/C/sample1.txt b/atcoder/abc059/C/sample1.txt new file mode 100644 index 00000000..b0a74b6b --- /dev/null +++ b/atcoder/abc059/C/sample1.txt @@ -0,0 +1,2 @@ +2 +0 2 \ No newline at end of file diff --git a/atcoder/abc059/C/sample2.txt b/atcoder/abc059/C/sample2.txt new file mode 100644 index 00000000..7953cb84 --- /dev/null +++ b/atcoder/abc059/C/sample2.txt @@ -0,0 +1,2 @@ +2 +0 -2 \ No newline at end of file diff --git a/atcoder/abc059/C/sample3.txt b/atcoder/abc059/C/sample3.txt new file mode 100644 index 00000000..b24c72a1 --- /dev/null +++ b/atcoder/abc059/C/sample3.txt @@ -0,0 +1,2 @@ +3 +0 2 -2 \ No newline at end of file diff --git a/atcoder/abc059/D/main.cpp b/atcoder/abc059/D/main.cpp new file mode 100644 index 00000000..34fa0b43 --- /dev/null +++ b/atcoder/abc059/D/main.cpp @@ -0,0 +1,20 @@ +#include + +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; +} \ No newline at end of file