From 39af2624d53a9aa3682404884629dbd1aee5e712 Mon Sep 17 00:00:00 2001 From: Anthony Wang Date: Sat, 25 Jul 2020 18:07:43 -0500 Subject: [PATCH] Clean up repo --- .vscode/settings.json | 77 ++++++++++++++++++++++++++++++++++++++++--- guess.cpp | 43 ++++++++++++++++++++++++ gymnastics.java | 0 gymnastics.py | 0 lineup.cpp | 6 ---- lineup.java | 3 -- lineup.py | 0 shell.cpp | 38 +++++++++++++++++++++ sleepy.cpp | 25 ++++++++++++++ whereami.java | 0 whereami.py | 0 11 files changed, 179 insertions(+), 13 deletions(-) create mode 100644 guess.cpp delete mode 100644 gymnastics.java delete mode 100644 gymnastics.py delete mode 100644 lineup.cpp delete mode 100644 lineup.java delete mode 100644 lineup.py create mode 100644 shell.cpp create mode 100644 sleepy.cpp delete mode 100644 whereami.java delete mode 100644 whereami.py diff --git a/.vscode/settings.json b/.vscode/settings.json index 91e2cef..6103329 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -1,5 +1,74 @@ -{ - "files.associations": { - "iosfwd": "cpp" - } +{ + "files.associations": { + "iostream": "cpp", + "iomanip": "cpp", + "ostream": "cpp", + "array": "cpp", + "atomic": "cpp", + "*.tcc": "cpp", + "bitset": "cpp", + "cctype": "cpp", + "cfenv": "cpp", + "chrono": "cpp", + "cinttypes": "cpp", + "clocale": "cpp", + "cmath": "cpp", + "codecvt": "cpp", + "complex": "cpp", + "condition_variable": "cpp", + "csetjmp": "cpp", + "csignal": "cpp", + "cstdarg": "cpp", + "cstddef": "cpp", + "cstdint": "cpp", + "cstdio": "cpp", + "cstdlib": "cpp", + "cstring": "cpp", + "ctime": "cpp", + "cuchar": "cpp", + "cwchar": "cpp", + "cwctype": "cpp", + "deque": "cpp", + "forward_list": "cpp", + "list": "cpp", + "unordered_map": "cpp", + "unordered_set": "cpp", + "vector": "cpp", + "exception": "cpp", + "algorithm": "cpp", + "functional": "cpp", + "iterator": "cpp", + "map": "cpp", + "memory": "cpp", + "memory_resource": "cpp", + "numeric": "cpp", + "optional": "cpp", + "random": "cpp", + "ratio": "cpp", + "regex": "cpp", + "set": "cpp", + "string": "cpp", + "string_view": "cpp", + "system_error": "cpp", + "tuple": "cpp", + "type_traits": "cpp", + "utility": "cpp", + "fstream": "cpp", + "future": "cpp", + "initializer_list": "cpp", + "iosfwd": "cpp", + "istream": "cpp", + "limits": "cpp", + "mutex": "cpp", + "new": "cpp", + "scoped_allocator": "cpp", + "shared_mutex": "cpp", + "sstream": "cpp", + "stdexcept": "cpp", + "streambuf": "cpp", + "thread": "cpp", + "typeindex": "cpp", + "typeinfo": "cpp", + "valarray": "cpp" + } } \ No newline at end of file diff --git a/guess.cpp b/guess.cpp new file mode 100644 index 0000000..035150d --- /dev/null +++ b/guess.cpp @@ -0,0 +1,43 @@ +#include +using namespace std; + +int K[101]; +string charact[101][101]; + +int main() { + ifstream cin("guess.in"); + ofstream cout("guess.out"); + + int N; + cin >> N; + + for (int i = 0; i < N; ++i) { + string name; + cin >> name; + + cin >> K[i]; + for (int j = 0; j < K[i]; ++j) cin >> charact[i][j]; + } + + int ans = 0; + for (int a = 0; a < N; ++a) { + for (int b = a + 1; b < N; ++b) { + int cnt = 0; // a and b are the two animals + + for (int i = 0; i < K[a]; ++i) { + bool found = false; + + // search for a's charact in b's characts + for (int j = 0; j < K[b]; ++j) { + if (charact[a][i] == charact[b][j]) found = true; + } + + if (found == true) ++cnt; + } + + ans = max(cnt + 1, ans); + } + } + + cout << ans; +} \ No newline at end of file diff --git a/gymnastics.java b/gymnastics.java deleted file mode 100644 index e69de29..0000000 diff --git a/gymnastics.py b/gymnastics.py deleted file mode 100644 index e69de29..0000000 diff --git a/lineup.cpp b/lineup.cpp deleted file mode 100644 index 7121a4b..0000000 --- a/lineup.cpp +++ /dev/null @@ -1,6 +0,0 @@ -#include -using namespace std; - -int main() { - -} \ No newline at end of file diff --git a/lineup.java b/lineup.java deleted file mode 100644 index a63e60e..0000000 --- a/lineup.java +++ /dev/null @@ -1,3 +0,0 @@ -public class lineup { - -} \ No newline at end of file diff --git a/lineup.py b/lineup.py deleted file mode 100644 index e69de29..0000000 diff --git a/shell.cpp b/shell.cpp new file mode 100644 index 0000000..97b641d --- /dev/null +++ b/shell.cpp @@ -0,0 +1,38 @@ +#include +using namespace std; + +int main() { + ifstream cin("shell.in"); + ofstream cout("shell.out"); + + int N; + cin >> N; + + int a[101], b[101], g[101]; + for (int i = 0; i < N; ++i) { + cin >> a[i] >> b[i] >> g[i]; + } + + int ans = 0; + + for (int start : { 1, 2, 3 }) { + int pos = start; + int cnt = 0; + for (int i = 0; i < N; ++i) { + if (pos == a[i]) { + pos = b[i]; + } + else if (pos == b[i]) { + pos = a[i]; + } + + if (pos == g[i]) { + ++cnt; + } + } + + ans = max(cnt, ans); + } + + cout << ans; +} \ No newline at end of file diff --git a/sleepy.cpp b/sleepy.cpp new file mode 100644 index 0000000..145ff3a --- /dev/null +++ b/sleepy.cpp @@ -0,0 +1,25 @@ +#include +using namespace std; + +int main() { + ifstream cin("sleepy.in"); + ofstream cout("sleepy.out"); + + int N; + cin >> N; + + int p[101]; + for (int i = 0; i < N; ++i) cin >> p[i]; + + int ans = 1; + for (int i = N - 2; i >= 0; --i) { + if (p[i] < p[i + 1]) { + ++ans; + } + else { + break; + } + } + + cout << N - ans; +} \ No newline at end of file diff --git a/whereami.java b/whereami.java deleted file mode 100644 index e69de29..0000000 diff --git a/whereami.py b/whereami.py deleted file mode 100644 index e69de29..0000000