結果

問題 No.2194 兄弟の掛け引き
ユーザー soranjirosoranjiro
提出日時 2023-02-20 22:18:21
言語 C
(gcc 12.3.0)
結果
WA  
実行時間 -
コード長 833 bytes
コンパイル時間 1,312 ms
コンパイル使用メモリ 27,816 KB
実行使用メモリ 4,380 KB
最終ジャッジ日時 2023-09-28 17:43:51
合計ジャッジ時間 1,139 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 AC 0 ms
4,376 KB
testcase_02 AC 1 ms
4,376 KB
testcase_03 AC 1 ms
4,380 KB
testcase_04 AC 1 ms
4,380 KB
testcase_05 AC 1 ms
4,380 KB
testcase_06 AC 0 ms
4,376 KB
testcase_07 AC 0 ms
4,376 KB
testcase_08 AC 0 ms
4,376 KB
testcase_09 AC 1 ms
4,380 KB
testcase_10 AC 1 ms
4,380 KB
testcase_11 AC 0 ms
4,376 KB
testcase_12 AC 1 ms
4,380 KB
testcase_13 WA -
testcase_14 WA -
testcase_15 AC 1 ms
4,380 KB
testcase_16 AC 1 ms
4,380 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<stdio.h>

int main(){
    int A,B,C;
    int n1, n2;
    int flg=0;
    
    scanf("%d", &A);
    scanf("%d", &B);
    scanf("%d", &C);
    
    if((C+B)%A==0){
        n1 = (C+B)/A;
        flg = 2;
    }
    if(C%A==0 && C-B<0){
        n2 = C/A;
        flg ++;
    }
    switch(flg){
        case 0:
            printf("%d\n",-1);
            break;
        case 1:
            printf("%d\n",n2);
            break;
        case 2:
            printf("%d\n",n1);
            break;
        case 3:
            if(n2>n1){
                printf("%d\n",n1);
                printf("%d\n",n2);
            }else{
                printf("%d\n",n2);
                printf("%d\n",n1);
            }
            break;
        default:
            printf("%d\n",-1);
            break;
        
    }
    
    
    return 0;
}
0