よじろめ覚書

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

2019-11-19から1日間の記事一覧

ABC102A - Multiple of 2 and N

ABC

問題:A - Multiple of 2 and N #include <iostream> using namespace std; int GCD(int a, int b){ return b? GCD(b, a % b) : a; } int LCM(int a, int b) { return a * b / GCD(a, b); } int main(void) { int n; cin.tie(0); ios::sync_with_stdio(false); cin >> </iostream>…

ABC101B - Digit Sums

ABC

問題:B - Digit Sums #include <iostream> using namespace std; int getS(int x_n) { int ret = 0; while (x_n > 0) { ret += x_n % 10; x_n /= 10; } return ret; } int main(void) { int n; cin.tie(0); ios::sync_with_stdio(false); cin >> n; cout << (n % getS</iostream>…

ABC101A - Eating Symbols Easy

ABC

問題:A - Eating Symbols Easy #include <iostream> #include <string> using namespace std; #define REP(i, n) for (int i = 0; i < (n); ++i) int getCount(string x_s, char x_op) { int cnt = 0; REP(i, x_s.length()) { if (x_s[i] == x_op) { ++cnt; } } return cnt; }</string></iostream>…