よじろめ覚書

私の理解度重視のソースコードです。

2020-01-20から1日間の記事一覧

ABC139B - Power Socket

ABC

問題:B - Power Socket #include <iostream> using namespace std; int main(void) { int a, b; cin.tie(0); ios::sync_with_stdio(false); cin >> a >> b; cout << (b - 1 + a - 2) / (a - 1) << "\n"; return 0; }</iostream>

ABC139A - Tenki

ABC

問題:A - Tenki #include <iostream> #include <string> using namespace std; #define REP(i, n) for (int i = 0; i < (n); ++i) int main(void) { int ans = 0; string s, t; cin.tie(0); ios::sync_with_stdio(false); cin >> s; cin >> t; REP(i, s.length()) { if (s[i] </string></iostream>…

ABC138B - Resistors in Parallel

ABC

問題:B - Resistors in Parallel #include <iomanip> #include <iostream> using namespace std; #define REP(i, n) for (int i = 0; i < (n); ++i) int main(void) { int n, a; double ans = 0.0; cin.tie(0); ios::sync_with_stdio(false); cin >> n; REP(i, n) { cin >> a; </iostream></iomanip>…

ABC138A - Red or Not

ABC

問題: #include <iostream> #include <string> using namespace std; int main(void) { int a; string s; cin.tie(0); ios::sync_with_stdio(false); cin >> a; cin >> s; cout << (a < 3200? "red" : s) << "\n"; return 0; }</string></iostream>

ABC137B - One Clue

ABC

問題:B - One Clue #include <iostream> using namespace std; #define FOR(i, a, b) for (int i = (a); i < (b); ++i) int main(void) { int k, x; cin.tie(0); ios::sync_with_stdio(false); cin >> k >> x; FOR (i, x - k + 1, x + k) { cout << i; cout << (i != </iostream>…