結果

問題 No.982 Add
ユーザー KKT89KKT89
提出日時 2020-02-11 13:51:09
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 653 bytes
コンパイル時間 915 ms
コンパイル使用メモリ 96,860 KB
実行使用メモリ 6,676 KB
最終ジャッジ日時 2024-04-08 14:47:34
合計ジャッジ時間 1,710 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
6,548 KB
testcase_01 WA -
testcase_02 AC 2 ms
6,548 KB
testcase_03 AC 3 ms
6,548 KB
testcase_04 WA -
testcase_05 AC 3 ms
6,548 KB
testcase_06 AC 2 ms
6,548 KB
testcase_07 AC 2 ms
6,548 KB
testcase_08 AC 2 ms
6,548 KB
testcase_09 AC 3 ms
6,548 KB
testcase_10 AC 3 ms
6,548 KB
testcase_11 AC 3 ms
6,548 KB
testcase_12 AC 2 ms
6,548 KB
testcase_13 AC 2 ms
6,548 KB
testcase_14 AC 2 ms
6,548 KB
testcase_15 AC 3 ms
6,548 KB
testcase_16 AC 2 ms
6,548 KB
testcase_17 AC 3 ms
6,548 KB
testcase_18 WA -
testcase_19 WA -
testcase_20 WA -
testcase_21 WA -
testcase_22 WA -
testcase_23 WA -
testcase_24 AC 3 ms
6,548 KB
testcase_25 AC 3 ms
6,548 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <algorithm>
#include <vector>
#include <set>
#include <math.h>
#include <map>
#include <numeric>
using namespace std;
typedef long long int ll;

int main(){
	cin.tie(nullptr);
	ios::sync_with_stdio(false);
    int a,b; cin >> a >> b;
    if(__gcd(a,b)!=1){
        cout << -1 << endl;
    }
    int ans=0;
    for(int i=1;i<=100*100;i++){
        bool ok=0;
        for(int j=0;j<=100;j++){
            if(i-a*j>=0){
                if((i-a*j)%b==0){
                    ok=1;
                    break;
                }
            }
            else break;
        }
        if(!ok)ans++;
    }
    cout << ans << endl;
}
0