結果

問題 No.112 ややこしい鶴亀算
コンテスト
ユーザー Himatsubushin
提出日時 2022-11-16 13:59:35
言語 C(gnu17)
(gcc 15.2.0)
コンパイル:
gcc-15 -O2 -std=gnu17 -Wno-error=implicit-function-declaration -Wno-error=implicit-int -Wno-error=incompatible-pointer-types -Wno-error=int-conversion -DONLINE_JUDGE -o a.out _filename_ -lm
実行:
./a.out
結果
WA  
実行時間 -
コード長 816 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 154 ms
コンパイル使用メモリ 36,836 KB
最終ジャッジ日時 2026-02-22 09:48:22
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1 WA * 1
other AC * 5 WA * 18
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

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

                            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