結果

問題 No.2194 兄弟の掛け引き
ユーザー dm99xdm99x
提出日時 2023-07-28 03:09:29
言語 C
(gcc 12.3.0)
結果
WA  
実行時間 -
コード長 1,048 bytes
コンパイル時間 336 ms
コンパイル使用メモリ 29,312 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-04-15 13:04:23
合計ジャッジ時間 1,276 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

#include <stdio.h>

int main(void)
{
    int N = 1;
    int A, B, C, X;
    scanf("%d %d %d", &A, &B, &C);
    while(1)
    {
        X = N * A - B;
        if(X <= 0)
        {
            if(N * A != C)
            {
                if(N == 1)
                {
                    printf("%d", -1);
                    break;
                }
                else
                {
                    N++;
                }
            }
            else
            {
                printf("%d\n", N);
                N++;
            }
        }
        else
        {
            if(X > C)
            {
                if(N == 1)
                {
                    printf("%d", -1);
                    break;
                }
                else
                {
                    break;
                }
            }
            else if(X < C)
            {
                N++;
            }
            else
            {
                printf("%d\n", N);
                N++;
            }
        }
    }

    return 0;
}
0