よじろめ覚書

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

ABC060B - Choose Integers

問題: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;
        }
    }

    cout << (flg? "YES": "NO") << "\n";
    return 0;
}