結果

問題 No.112 ややこしい鶴亀算
ユーザー Himatsubushin
提出日時 2022-11-16 13:59:35
言語 C
(gcc 13.3.0)
結果
WA  
実行時間 -
コード長 816 bytes
コンパイル時間 132 ms
コンパイル使用メモリ 28,032 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-09-17 10:33:32
合計ジャッジ時間 1,028 ms
ジャッジサーバーID
(参考情報)
judge2 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1 WA * 1
other AC * 10 WA * 13
権限があれば一括ダウンロードができます

ソースコード

diff #

/******************************************************************************

                            Online C Compiler.
                Code, Compile, Run and Debug C program online.
Write your code in this editor and press "Run" button to compile and execute it.

*******************************************************************************/

#include <stdio.h>

int main() {
    int i, d, n, base, temp, turtle, crane;

    scanf("%d", &n);
    scanf("%d", &base);
    turtle = 1;
    crane = 0;

    for (i = 1; i < n; i++) {
        scanf("%d", &d);
        if (base == d)
            turtle++;
        else {
            crane++;
            temp = d;
        }
    }

    if (base < temp)
        printf("%d %d\n", turtle, crane);
    else
        printf("%d %d\n", crane, turtle);

    return 0;
}
0