結果

問題 No.2194 兄弟の掛け引き
ユーザー Manuel1024Manuel1024
提出日時 2023-01-20 21:25:38
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 3 ms / 1,000 ms
コード長 621 bytes
コンパイル時間 1,485 ms
コンパイル使用メモリ 93,096 KB
実行使用メモリ 4,380 KB
最終ジャッジ日時 2023-09-05 13:33:26
合計ジャッジ時間 1,675 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,380 KB
testcase_01 AC 3 ms
4,380 KB
testcase_02 AC 3 ms
4,376 KB
testcase_03 AC 2 ms
4,380 KB
testcase_04 AC 3 ms
4,376 KB
testcase_05 AC 3 ms
4,380 KB
testcase_06 AC 3 ms
4,376 KB
testcase_07 AC 3 ms
4,376 KB
testcase_08 AC 3 ms
4,376 KB
testcase_09 AC 3 ms
4,376 KB
testcase_10 AC 3 ms
4,380 KB
testcase_11 AC 3 ms
4,376 KB
testcase_12 AC 3 ms
4,380 KB
testcase_13 AC 3 ms
4,380 KB
testcase_14 AC 3 ms
4,376 KB
testcase_15 AC 2 ms
4,376 KB
testcase_16 AC 3 ms
4,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <queue>
#include <deque>
#include <cmath>
#include <iomanip>
#include <set>
#include <map>
using namespace std;
using ll = long long;
using ld = long double;

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

    vector<int> res;
    for(ll n = 1; n <= 1000000; n++){
        if(n*a-b > 0 && n*a-b == c) res.emplace_back(n);
        else if(n*a-b <= 0 && n*a == c) res.emplace_back(n);
    }
    if(res.size() == 0) cout << -1 << endl;
    else{
        for(int i = 0; i < res.size(); i++) cout << res[i] << '\n';
    }
    return 0;
}
0