From 3e4759a8ff6fc9c411f8de6b8a13cea0d9c15279 Mon Sep 17 00:00:00 2001 From: kweonminsung Date: Mon, 25 Dec 2023 17:23:53 +0900 Subject: [PATCH] feat: 2023/12/26 --- 10816/main.cpp | 25 +++++++++++++++++++++++++ 10989/main.cpp | 24 ++++++++++++++++++++++++ 11478/main.cpp | 20 ++++++++++++++++++++ 1269/main.cpp | 20 ++++++++++++++++++++ 1764/main.cpp | 31 +++++++++++++++++++++++++++++++ 25305/main.cpp | 21 +++++++++++++++++++++ 2587/main.cpp | 21 +++++++++++++++++++++ 2750/main.cpp | 21 +++++++++++++++++++++ 2751/main.cpp | 21 +++++++++++++++++++++ input.txt | 41 ++++++++++------------------------------- template/main.cpp | 6 ++---- 11 files changed, 216 insertions(+), 35 deletions(-) create mode 100755 10816/main.cpp create mode 100755 10989/main.cpp create mode 100755 11478/main.cpp create mode 100755 1269/main.cpp create mode 100755 1764/main.cpp create mode 100755 25305/main.cpp create mode 100755 2587/main.cpp create mode 100755 2750/main.cpp create mode 100755 2751/main.cpp diff --git a/10816/main.cpp b/10816/main.cpp new file mode 100755 index 0000000..b2b07de --- /dev/null +++ b/10816/main.cpp @@ -0,0 +1,25 @@ +#include + +using namespace std; + +int main() { + ios::sync_with_stdio(0); + cin.tie(0); + + int n; + cin >> n; + map j; + for (int i = 0; i < n; i++) { + int input; + cin >> input; + j[input]++; + } + + int m; + cin >> m; + while (m--) { + int input; + cin >> input; + cout << j[input] << " "; + } +} diff --git a/10989/main.cpp b/10989/main.cpp new file mode 100755 index 0000000..a4412e6 --- /dev/null +++ b/10989/main.cpp @@ -0,0 +1,24 @@ +#include + +using namespace std; + +int main() { + ios::sync_with_stdio(0); + cin.tie(0); + + int n; + cin >> n; + map m; + int maxN = 0; + for (int i = 0; i < n; i++) { + int input; + cin >> input; + m[input]++; + maxN = max(input, maxN); + } + + for (int i = 1; i <= maxN; i++) { + for (int j = 0; j < m[i]; j++) + cout << i << "\n"; + } +} diff --git a/11478/main.cpp b/11478/main.cpp new file mode 100755 index 0000000..75889cf --- /dev/null +++ b/11478/main.cpp @@ -0,0 +1,20 @@ +#include + +using namespace std; + +int main() { + ios::sync_with_stdio(0); + cin.tie(0); + + string str; + cin >> str; + set s; + + for (int i = 1; i <= str.size(); i++) { + for (int j = 0; j < str.size() - i + 1; j++) { + s.insert(str.substr(j, i)); + } + } + + cout << s.size(); +} diff --git a/1269/main.cpp b/1269/main.cpp new file mode 100755 index 0000000..f61cf47 --- /dev/null +++ b/1269/main.cpp @@ -0,0 +1,20 @@ +#include + +using namespace std; + +int main() { + ios::sync_with_stdio(0); + cin.tie(0); + + int n, m; + cin >> n >> m; + set s; + + for (int i = 0; i < n + m; i++) { + int input; + cin >> input; + s.insert(input); + } + + cout << 2 * s.size() - m - n; +} diff --git a/1764/main.cpp b/1764/main.cpp new file mode 100755 index 0000000..e197850 --- /dev/null +++ b/1764/main.cpp @@ -0,0 +1,31 @@ +#include + +using namespace std; + +int main() { + ios::sync_with_stdio(0); + cin.tie(0); + + int n, m, cnt = 0; + cin >> n >> m; + map j; + for (int i = 0; i < n; i++) { + string input; + cin >> input; + j[input] = 1; + } + + set s; + while (m--) { + string input; + cin >> input; + if (j[input] == 1) { + s.insert(input); + cnt++; + } + } + + cout << cnt << "\n"; + for (auto i : s) + cout << i << "\n"; +} diff --git a/25305/main.cpp b/25305/main.cpp new file mode 100755 index 0000000..db1b844 --- /dev/null +++ b/25305/main.cpp @@ -0,0 +1,21 @@ +#include + +using namespace std; + +int main() { + ios::sync_with_stdio(0); + cin.tie(0); + + int n, k; + cin >> n >> k; + vector v; + for (int i = 0; i < n; i++) { + int input; + cin >> input; + v.push_back(input); + } + + sort(v.rbegin(), v.rend()); + + cout << v[k - 1]; +} diff --git a/2587/main.cpp b/2587/main.cpp new file mode 100755 index 0000000..d31631f --- /dev/null +++ b/2587/main.cpp @@ -0,0 +1,21 @@ +#include + +using namespace std; + +int main() { + ios::sync_with_stdio(0); + cin.tie(0); + + int tot = 0; + vector v; + + for (int i = 0; i < 5; i++) { + int input; + cin >> input; + tot += input; + v.push_back(input); + } + sort(v.begin(), v.end()); + + cout << tot / 5 << "\n" << v[2]; +} diff --git a/2750/main.cpp b/2750/main.cpp new file mode 100755 index 0000000..1e5b39d --- /dev/null +++ b/2750/main.cpp @@ -0,0 +1,21 @@ +#include + +using namespace std; + +int main() { + ios::sync_with_stdio(0); + cin.tie(0); + + int n; + cin >> n; + set s; + + while (n--) { + int input; + cin >> input; + s.insert(input); + } + + for (auto i : s) + cout << i << "\n"; +} diff --git a/2751/main.cpp b/2751/main.cpp new file mode 100755 index 0000000..33ed90b --- /dev/null +++ b/2751/main.cpp @@ -0,0 +1,21 @@ +#include + +using namespace std; + +int main() { + ios::sync_with_stdio(0); + cin.tie(0); + + int n; + cin >> n; + set s; + + for (int i = 0; i < n; i++) { + int input; + cin >> input; + s.insert(input); + } + + for (auto i : s) + cout << i << "\n"; +} diff --git a/input.txt b/input.txt index 3bf56f3..5ca0303 100755 --- a/input.txt +++ b/input.txt @@ -1,32 +1,11 @@ -26 5 -Bulbasaur -Ivysaur -Venusaur -Charmander -Charmeleon -Charizard -Squirtle -Wartortle -Blastoise -Caterpie -Metapod -Butterfree -Weedle -Kakuna -Beedrill -Pidgey -Pidgeotto -Pidgeot -Rattata -Raticate -Spearow -Fearow -Ekans -Arbok -Pikachu -Raichu -25 -Raichu +10 +5 +2 3 -Pidgey -Kakuna \ No newline at end of file +1 +4 +2 +3 +5 +1 +7 \ No newline at end of file diff --git a/template/main.cpp b/template/main.cpp index 10eb1f7..57880e9 100755 --- a/template/main.cpp +++ b/template/main.cpp @@ -3,8 +3,6 @@ using namespace std; int main() { - ios::sync_with_stdio(0); - cin.tie(0); - - + ios::sync_with_stdio(0); + cin.tie(0); }