結果

問題 No.485 方程式のお勉強
ユーザー Elk
提出日時 2018-05-23 00:28:07
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
WA  
実行時間 -
コード長 409 bytes
コンパイル時間 157 ms
コンパイル使用メモリ 24,064 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-06-28 15:56:04
合計ジャッジ時間 831 ms
ジャッジサーバーID
(参考情報)
judge1 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 11 WA * 2
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:7:10: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
    7 |     scanf("%d %d", &A, &B);
      |     ~~~~~^~~~~~~~~~~~~~~~~

ソースコード

diff #

#include<stdio.h>
#include<stdlib.h>

int main(){
    int A, B, C;

    scanf("%d %d", &A, &B);

    if(abs(A) > abs(B)){
        if(A%B == 0){
            C = A/B;
            printf("%d\n", C);
        }else{
            printf("NO\n");
        }
    }else{
        if(B%A == 0){
            C = B/A;
            printf("%d\n", C);
        }else{
            printf("NO\n");
        }
    }

    return 0;
}
0