結果

問題 No.2194 兄弟の掛け引き
ユーザー hiragnhiragn
提出日時 2023-05-17 17:59:12
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 2 ms / 1,000 ms
コード長 686 bytes
コンパイル時間 951 ms
コンパイル使用メモリ 111,396 KB
最終ジャッジ日時 2025-02-13 01:05:52
ジャッジサーバーID
(参考情報)
judge2 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 14
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <sstream>
#include <fstream>
#include <string>
#include <vector>
#include <deque>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <algorithm>
#include <functional>
#include <utility>
#include <bitset>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <cstdio>

using namespace std;
using ll = long long;

int main() {
    ll a, b, c;
    cin >> a >> b >> c;

    bool flag = false;
    ll d;
    for (ll i = 1; i <= 2e5; ++i) {
        d = a * i;
        if (d > b) d -= b;
        if (d == c) {
            flag = true;
            cout << i << endl;
        }
    }

    if (!flag) cout << -1 << endl;
    return 0;
}
0