diff --git a/1431_SERIAL.cpp b/1431_SERIAL.cpp new file mode 100644 index 0000000..4bb6334 --- /dev/null +++ b/1431_SERIAL.cpp @@ -0,0 +1,52 @@ +#include +#include +#include + +using namespace std; + +int n; +string a[1000]; + +int integer_sum(string a){ + int length = a.length(); + int sum =0; + for(int i = 0; i =0){ + sum += a[i] - '0'; + } + } + return sum; +} + +bool compare (string a, string b){ + if(a.length()b.length()){ + return 0; + } + else { + int sum_a = integer_sum(a); + int sum_b = integer_sum(b); + + if (sum_a < sum_b){ + return 1; + } + else if (sum_a > sum_b) { + return 0; + } + else { + return a < b; + } + } +} +int main(){ + cin >> n; + for (int i = 0; i < n; i++){ + cin >> a[i]; + } + sort (a, a+n, compare); + for (int i = 0; i < n; i++){ + cout << a[i] << ' ' < +#include +#include + +using namespace std; + +int n, m, cnt = 0; +set s; + +int main() +{ + ios_base::sync_with_stdio(0); + cin.tie(0); + + cin >> n >> m; + for (int i = 0; i < n; i++){ + string tmp; + cin >> tmp; + s.insert(tmp); + } + for (int i = 0; i > tmp; + if (s.find(tmp) != s.end()) cnt++; + } + cout < +#include + +using namespace std; + +int main(){ + int w, basic, t, day; + int d_input, d_output; + + cin >> w >> basic >> t; + cin >> day >> d_input >> d_output; + + int w1 = w; + int w2 = w; + + int basic2 = basic; + + for(int i=0; it) + basic2 += floor((d_input - (basic2+d_output))/2.0); + } + if (21 <= 0) + cout << "Danger Diet\n"; + else + cout << w1 << " " << basic << "\n"; + + if (w2 <= 0 || basic2 <= 0) + cout << "Danger Diet\n"; + else{ + cout << w2 << " " << basic2 << " "; + if (basic - basic2 > 0) + cout << "YOYO"; + else + cout << "NO"; + } +} \ No newline at end of file diff --git a/BOJ_1001.cpp b/BOJ_1001.cpp new file mode 100644 index 0000000..ef11ca5 --- /dev/null +++ b/BOJ_1001.cpp @@ -0,0 +1,11 @@ +#include + +using namespace std; + +int main(){ + string str; + cin >> str; + + cout << "알튜비튜 7기 화이팅!" + cout << "중도하차 안돼요!" +} \ No newline at end of file