よじろめ覚書

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

2019-08-01から1ヶ月間の記事一覧

ABC062B - Picture Frame

ABC

問題:B - Picture Frame #include <iostream> #include <string> using namespace std; #define REP(i, n) for (int i = 0; i < (n); ++i) int main(void) { int h, w; string a[100], line = ""; cin.tie(0); ios::sync_with_stdio(false); cin >> h >> w; REP(i, h) { cin ></string></iostream>…

ABC062A - Grouping

ABC

問題:A - Grouping #include <iostream> using namespace std; int main(void) { const int group[12] = {0, 1, 0, 2, 0, 2 ,0, 0, 2, 0, 2}; int x, y; cin.tie(0); ios::sync_with_stdio(false); cin >> x >> y; cout << (group[x - 1] == group[y - 1]? "Yes" : "N</iostream>…

ABC061B - Counting Roads

ABC

問題:B - Counting Roads #include <iostream> using namespace std; #define REP(i, n) for (int i = 0; i < (n); ++i) int main(void){ int n, m, a, b, road[50]; cin >> n >> m; REP(i, n) { road[i] = 0; } REP(i, m) { cin >> a >> b; road[a - 1]++; road[b - </iostream>…

ABC061A - Between Two Integers

ABC

問題:A - Between Two Integers #include <iostream> using namespace std; int main(void) { int a, b, c; cin.tie(0); ios::sync_with_stdio(false); cin >> a >> b >> c; cout << (a <= c && c <= b? "Yes" : "No") << "\n"; return 0; }</iostream>

ABC060B - Choose Integers

ABC

問題:B - Choose Integers #include <iostream> using namespace std; int main(void) { int a, b, c; bool flg = false; cin.tie(0); ios::sync_with_stdio(false); cin >> a >> b >> c; for (int i = a; i <= a * b; i += a) { if (i % b == c) { flg = true; break</iostream>…

ABC060A - Shiritori

ABC

問題:A - Shiritori #include <iostream> #include <string> using namespace std; int main(void) { string a, b, c; cin.tie(0); ios::sync_with_stdio(false); cin >> a >> b >> c; cout << (a[a.length() -1] == b[0] && b[b.length() - 1] == c[0]? "YES" : "NO") << "\n</string></iostream>…

ABC059B - Comparison

ABC

問題:B - Comparison #include <iostream> #include <string> using namespace std; int main(void) { const string ret[3] = {"GREATER", "LESS", "EQUAL"}; string a, b; int rank = 2; cin.tie(0); ios::sync_with_stdio(false); cin >> a >> b; if (a.length() > b.length</string></iostream>…

ABC059A - Three-letter acronym

ABC

問題:A - Three-letter acronym #include <cctype> #include <iostream> #include <string> using namespace std; int main(void) { string a, b, c, ans = ""; cin.tie(0); ios::sync_with_stdio(false); cin >> a >> b >> c; ans += toupper(a[0]); ans += toupper(b[0]); ans += to</string></iostream></cctype>…

ABC058B - ∵∴∵

ABC

問題:B - ∵∴∵ #include <iostream> #include <string> using namespace std; #define REP(i, n) for(int i = 0; i < (n); ++i) int main(void) { string o, e, ans = ""; cin.tie(0); ios::sync_with_stdio(false); cin >> o; cin >> e; REP(i, o.length() + e.length()) { an</string></iostream>…

ABC058A - ι⊥l

ABC

問題:A - ι⊥l #include <iostream> using namespace std; int main(void) { int a, b, c; cin.tie(0); ios::sync_with_stdio(false); cin >> a >> b >> c; cout << (b - a == c - b? "YES" : "NO") << "\n"; return 0; } Yes, Noと表示していて、1WA。。</iostream>

ABC057B - Checkpoints

ABC

問題:B - Checkpoints #include <cstdlib> #include <iostream> using namespace std; #define REP(i, n) for(int i = 0; i < (n); ++i) int main(void) { const int INF = 1e9; int n, m, a[50], b[50], c[50], d[50], min_dist, ans; cin.tie(0); ios::sync_with_stdio(false</iostream></cstdlib>…

ABC057A - Remaining Time

ABC

問題:A - Remaining Time #include <iostream> using namespace std; int main(void) { int a, b; cin.tie(0); ios::sync_with_stdio(false); cin >> a >> b; cout << (a + b) % 24 << "\n"; return 0; }</iostream>

ABC056B - NarrowRectanglesEasy

ABC

問題:B - NarrowRectanglesEasy #include <cstdlib> #include <iostream> using namespace std; int main(void) { int w, a, b, ans = 0; cin.tie(0); ios::sync_with_stdio(false); cin >> w >> a >> b; if (abs(a - b) > w) { ans = abs(a - b) - w; } cout << ans << "\n"; </iostream></cstdlib>…

ABC056A - HonestOrDishonest

ABC

問題:A - HonestOrDishonest #include <iostream> using namespace std; int main(void) { char a, b; cin.tie(0); ios::sync_with_stdio(false); cin >> a >> b; cout << (a == b? 'H' : 'D') << "\n"; return 0; }</iostream>

ABC055B - Training Camp

ABC

問題:B - Training Camp #include <iostream> using namespace std; #define FOR(i, a, b) for (int i = a; i < (b); ++i) int main(void) { const int MOD = 1e9 + 7; int n; long long ans = 1; cin.tie(0); ios::sync_with_stdio(false); cin >> n; FOR(i, 1, n + </iostream>…

ABC055A - Restaurant

ABC

問題:A - Restaurant #include <iostream> using namespace std; int main(void) { int n; cin.tie(0); ios::sync_with_stdio(false); cin >> n; cout << n * 800 - (n / 15) * 200 << "\n"; return 0; }</iostream>

ABC054B - Template Matching

ABC

問題:B - Template Matching #include <iostream> #include <string> using namespace std; #define REP(i, n) for (int i = 0; i < (n); ++i) string a[50], b[50]; bool isMatch(int n, int m, int y, int x) { if (m + y > n || m + x > n) { return false; } REP(i, m) { </string></iostream>…

ABC054A - One Card Poker

ABC

問題:B - Template Matching #include <iostream> #include <string> using namespace std; int main(void) { const string ret[3] = {"Alice", "Bob", "Draw"}; int a, b, pos; cin.tie(0); ios::sync_with_stdio(false); cin >> a >> b; a = (a == 1)? a + 13 : a; b = (b =</string></iostream>…

ABC053B - A to Z String

ABC

問題:B - A to Z String #include <iostream> #include <string> using namespace std; int main(void) { string s; cin.tie(0); ios::sync_with_stdio(false); cin >> s; cout << s.rfind('Z') - s.find('A') + 1 << "\n"; return 0; }</string></iostream>

ABC053A - ABC/ARC

ABC

問題:A - ABC/ARC #include <iostream> using namespace std; int main(void) { int x; cin.tie(0); ios::sync_with_stdio(false); cin >> x; cout << (x < 1200? "ABC" : "ARC") << "\n"; return 0; }</iostream>

ABC052B - Increment Decrement

ABC

問題:B - Increment Decrement #include <algorithm> #include <iostream> #include <string> using namespace std; #define REP(i, n) for (int i = 0; i < (n); ++i) int main(void) { int n, x = 0, max_x = 0; string s; cin.tie(0); ios::sync_with_stdio(false); cin >> n; cin >> </string></iostream></algorithm>…

ABC052A - Two Rectangles

ABC

問題:A - Two Rectangles #include <algorithm> #include <iostream> using namespace std; int main(void) { int a, b, c, d; cin.tie(0); ios::sync_with_stdio(false); cin >> a >> b >> c >> d; cout << max(a * b, c * d) << "\n"; return 0; }</iostream></algorithm>

ABC051B - Sum of Three Integers

ABC

問題:B - Sum of Three Integers #include <iostream> using namespace std; #define REP(i, n) for (int i = 0; i < (n); ++i) int main(void) { int k, s, ans = 0; cin.tie(0); ios::sync_with_stdio(false); cin >> k >> s; REP(x, k + 1) { REP(y, k + 1) { int </iostream>…

ABC051A - Haiku

ABC

問題:A - Haiku #include <iostream> #include <string> using namespace std; int main(void) { string s; cin.tie(0); ios::sync_with_stdio(false); cin >> s; cout << s.substr(0, 5) << " " << s.substr(5 + 1, 7) << " " << s.substr((5 + 1) + (7 + 1), 5) << "\n"; re</string></iostream>…

ABC050B - Contest with Drinks Easy

ABC

問題:B - Contest with Drinks Easy #include <iostream> using namespace std; #define REP(i, n) for(int i = 0; i < (n); ++i) int main(void){ int n, t[100], m, p, x, sum = 0; cin.tie(0); ios::sync_with_stdio(false); cin >> n; REP(i, n) { cin >> t[i]; s</iostream>…

ABC050A - Addition and Subtraction Easy

ABC

問題:A - Addition and Subtraction Easy #include <iostream> using namespace std; int main(void){ int a, b; char op; cin.tie(0); ios::sync_with_stdio(false); cin >> a >> op >> b; cout << (op == '+'? a + b : a - b) << "\n"; return 0; }</iostream>

ABC049B - たてなが / Thin

ABC

問題:B - たてなが / Thin #include <iostream> #include <string> using namespace std; #define REP(i, n) for (int i = 0; i < (n); ++i) int main(void) { int h, w; string c[100]; cin.tie(0); ios::sync_with_stdio(false); cin >> h >> w; REP(i, h) { cin >> c[i]; }</string></iostream>…

ABC049A - 居合を終え、青い絵を覆う / UOIAUAI

ABC

問題:A - 居合を終え、青い絵を覆う / UOIAUAI #include <iostream> #include <string> using namespace std; int main(void) { const string vowel = "aeiou"; char c; cin.tie(0); ios::sync_with_stdio(false); cin >> c; cout << (vowel.find(c) != string::npos? "vowel"</string></iostream>…

ABC048B - Between a and b ...

ABC

問題:B - Between a and b ... #include <iostream> using namespace std; int main(void) { long long a, b, x, ans; cin.tie(0); ios::sync_with_stdio(false); cin >> a >> b >> x; if (a == 0) { ans = b / x + 1; } else { ans = b / x - (a - 1) / x; } cout <<</iostream>…

ABC048A - AtCoder *** Contest

ABC

問題:A - AtCoder *** Contest #include <iostream> #include <string> using namespace std; int main(void) { string a, s, c; cin.tie(0); ios::sync_with_stdio(false); cin >> a >> s >> c; cout << "A" << s[0] << "C" << "\n"; return 0; }</string></iostream>