結果

問題 No.1509 Swap!!
ユーザー nawawan
提出日時 2021-05-14 23:58:24
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 657 bytes
コンパイル時間 855 ms
コンパイル使用メモリ 69,120 KB
実行使用メモリ 5,248 KB
最終ジャッジ日時 2024-10-02 06:34:21
合計ジャッジ時間 8,392 ms
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other AC * 6 WA * 24
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
long long extgcd(long long a, long long b, long long &x, long long &y){
    long long d = a;
    if(b != 0){
        d = extgcd(b, a % b, y, x);
        y -= (a / b) * x;
    }
    else{
        x = 1;
        y = 0;
    }
    return d;
}
int main(){
    int T;
    cin >> T;
    while(T--){
        long long N, A, B;
        cin >> N >> A >> B;
        long long x, y;
        long long g = extgcd(A, B, x, y);
        if(g != 1) cout << "NO" << endl;
        else{
            if(max(A, B) < N) cout << "YES" << endl;
            else cout << "NO" << endl;
        }
    }
}
0