結果

問題 No.982 Add
ユーザー KKT89KKT89
提出日時 2020-02-11 13:51:09
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 653 bytes
コンパイル時間 1,084 ms
コンパイル使用メモリ 95,500 KB
最終ジャッジ日時 2025-01-08 23:32:33
ジャッジサーバーID
(参考情報)
judge1 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2 WA * 1
other AC * 16 WA * 7
権限があれば一括ダウンロードができます

ソースコード

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