commit 8ccf561c670c2347090a3d5b75698f56a0a53bd3 Author: Abheek Dhawan Date: Wed Nov 3 20:19:45 2021 -0500 Initial commit diff --git a/codeforces/Caps Lock/a.out b/codeforces/Caps Lock/a.out new file mode 100755 index 0000000..1674dc1 Binary files /dev/null and b/codeforces/Caps Lock/a.out differ diff --git a/codeforces/Caps Lock/index.cpp b/codeforces/Caps Lock/index.cpp new file mode 100644 index 0000000..cd5c1bc --- /dev/null +++ b/codeforces/Caps Lock/index.cpp @@ -0,0 +1,40 @@ +using namespace std; + +#include +#include + +string parseString(string n) { + string m = n; + string o = n; + for (int i = 0; i < n.length(); i++) { + m[i] = toupper(n[i]); + } + o = m; + o[0] = tolower(m[0]); + if (m == n) { + return "v1"; + } else if (o == n) { + return "v2"; + } else { + return "v3"; + } +} + +int main() { + string n; + cin >> n; + string w; + w = parseString(n); + if (w == "v3") { + cout << n << endl; + } else { + for (int i = 0; i < n.length(); i++) { + if (i == 0 && w == "v2") { + n[0] = toupper(n[0]); + } else { + n[i] = tolower(n[i]); + } + } + cout << n << endl; + } +} diff --git a/codeforces/Next Round/a.out b/codeforces/Next Round/a.out new file mode 100755 index 0000000..42467b3 Binary files /dev/null and b/codeforces/Next Round/a.out differ diff --git a/codeforces/Next Round/index.cpp b/codeforces/Next Round/index.cpp new file mode 100644 index 0000000..3a9e24e --- /dev/null +++ b/codeforces/Next Round/index.cpp @@ -0,0 +1,30 @@ +using namespace std; + +#include + +int main() { + int n, k; + cin >> n >> k; + int w; + int a = 0; + for (int i = 0; i < n; i++) { + int j; + cin >> j; + if (j == 0) { + break; + } + if (i == k - 1) { + w = j; + a++; + } else if (i > k - 1) { + if (j == w) { + a++; + } else { + break; + } + } else { + a++; + } + } + cout << a << endl; +} diff --git a/codeforces/Soldier and Bananas/a.out b/codeforces/Soldier and Bananas/a.out new file mode 100755 index 0000000..91e6beb Binary files /dev/null and b/codeforces/Soldier and Bananas/a.out differ diff --git a/codeforces/Soldier and Bananas/index.cpp b/codeforces/Soldier and Bananas/index.cpp new file mode 100644 index 0000000..71bb126 --- /dev/null +++ b/codeforces/Soldier and Bananas/index.cpp @@ -0,0 +1,18 @@ +using namespace std; + +#include + +int main() { + int k, n, total_cost; + total_cost = 0; + long w; + cin >> k >> n >> w; + for (int i = 1; i < w + 1; i++) { + total_cost += i * k; + } + total_cost -= n; + if (total_cost < 0) { + total_cost = 0; + } + cout << total_cost << endl; +} diff --git a/codeforces/Team/a.out b/codeforces/Team/a.out new file mode 100755 index 0000000..9dff8e4 Binary files /dev/null and b/codeforces/Team/a.out differ diff --git a/codeforces/Team/index.cpp b/codeforces/Team/index.cpp new file mode 100644 index 0000000..746b9e0 --- /dev/null +++ b/codeforces/Team/index.cpp @@ -0,0 +1,21 @@ +using namespace std; + +#include + +int main() { + int n; + int c = 0; + cin >> n; + for (int i = 0; i < n; i++) { + int k = 0; + for (int j = 0; j < 3; j++) { + int l; + cin >> l; + k += l; + } + if (k >= 2) { + c += 1; + } + } + cout << c << endl; +} diff --git a/codeforces/Watermelon/a.out b/codeforces/Watermelon/a.out new file mode 100755 index 0000000..8589d57 Binary files /dev/null and b/codeforces/Watermelon/a.out differ diff --git a/codeforces/Watermelon/index.cpp b/codeforces/Watermelon/index.cpp new file mode 100644 index 0000000..fbc4c75 --- /dev/null +++ b/codeforces/Watermelon/index.cpp @@ -0,0 +1,15 @@ +using namespace std; + +#include + +int main() { + int n; + int i; + cin >> n; + i = n - 2; + if (i % 2 == 0 && i > 0) { + cout << "YES" << endl; + } else { + cout << "NO" << endl; + } +} diff --git a/codeforces/Way Too Long Words/a.out b/codeforces/Way Too Long Words/a.out new file mode 100755 index 0000000..0fdfb09 Binary files /dev/null and b/codeforces/Way Too Long Words/a.out differ diff --git a/codeforces/Way Too Long Words/index.cpp b/codeforces/Way Too Long Words/index.cpp new file mode 100644 index 0000000..767eb26 --- /dev/null +++ b/codeforces/Way Too Long Words/index.cpp @@ -0,0 +1,21 @@ +using namespace std; + +#include +#include + +int main() { + int n; + cin >> n; + for (int i = 0; i < n; i++) { + string s; + cin >> s; + int length = s.length(); + char first = s.front(); + char last = s.back(); + if (length > 10) { + cout << first << length << last << endl; + } else { + cout << s << endl; + } + } +} diff --git a/usaco/Teleportation/a.out b/usaco/Teleportation/a.out new file mode 100755 index 0000000..99953cf Binary files /dev/null and b/usaco/Teleportation/a.out differ diff --git a/usaco/Teleportation/index.cpp b/usaco/Teleportation/index.cpp new file mode 100644 index 0000000..001895e --- /dev/null +++ b/usaco/Teleportation/index.cpp @@ -0,0 +1,21 @@ +#include +int a, b, x, y; + +int main() { + std::cin >> a >> b >> x >> y; + int path1; + int path2; + int path3; + int ans; + path1 = std::abs(a - b); + path2 = std::abs(a - x) + std::abs(y - b); + path3 = std::abs(a - y) + std::abs(x - b); + ans = path1; + if (path2 < ans) { + ans = path2; + } + if (path3 < ans) { + ans = path3; + } + std::cout << ans << std::endl; +}