よじろめ覚書

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

ABC147B - Palindrome-philia

問題:B - Palindrome-philia

#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;

    cin.tie(0);
    ios::sync_with_stdio(false);
    cin >> s;
    REP(i, s.length() / 2) {
        if (i != s.length() - 1 - i && s[i] != s[s.length() - 1 - i]) {
            ans++;
        }
    }

    cout << ans << "\n";
    return 0;
}

ABC146A - Can't Wait for Holiday

問題:A - Can't Wait for Holiday

#include <algorithm>
#include <iostream>
#include <iterator>
#include <string>
#include <vector>
using namespace std;

#define ALL(c) (c).begin(), (c).end()

int main(void) {
    const vector<string> WEEKDAY = {"SUN", "MON", "TUE", "WED" , "THU", "FRI", "SAT"};
    string s;

    cin.tie(0);
    ios::sync_with_stdio(false);
    cin >> s;
    cout << 7 - distance(WEEKDAY.begin(), find(ALL(WEEKDAY), s)) << "\n";
    return 0;
}

ABC145B - Echo

問題:B - Echo

#include <iostream>
#include <string>
using namespace std;

int main(void) {
    int n;
    string s;

    cin.tie(0);
    ios::sync_with_stdio(false);
    cin >> n;
    cin >> s;
    cout << (n % 2 == 0 && s.substr(0, n / 2) == s.substr(n / 2, n)? "Yes" : "No") << "\n";
    return 0;
}

ABC144B - 81

問題:B - 81

#include <iostream>
using namespace std;

#define FOR(i, a, b) for (int i = (a); i < (b); ++i)

int main(void) {
    int n;
    bool flg = false;

    cin.tie(0);
    ios::sync_with_stdio(false);
    cin >> n;
    FOR(i, 1, 9 + 1) {
        FOR(j, 1, 9 + 1) {
            if (i * j == n) {
                flg = true;
            }
        }
    }

    cout << (flg? "Yes" : "No") << "\n";
    return 0;
}