結果

問題 No.816 Beautiful tuples
ユーザー howakuro
提出日時 2019-04-20 08:13:26
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
TLE  
実行時間 -
コード長 307 bytes
コンパイル時間 250 ms
コンパイル使用メモリ 27,392 KB
最終ジャッジ日時 2025-01-07 02:45:34
ジャッジサーバーID
(参考情報)
judge4 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 11 TLE * 4
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:4:10: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
    4 |     scanf("%d %d", &A, &B);
      |     ~~~~~^~~~~~~~~~~~~~~~~

ソースコード

diff #

#include <stdio.h>
int main(){
    int A,B;
    scanf("%d %d", &A, &B);
    for(int C = 1;C <= A + B; C++){
        if(A != C && B != C){
            if((A+B)%C == 0 && (B+C) % A == 0 && (C+A)%B==0){
                printf("%d",C);
                return 0;
            }
        }
    }
    printf("-1");
}
0