結果

問題 No.112 ややこしい鶴亀算
ユーザー umashikaumashika
提出日時 2016-02-02 00:07:29
言語 C90
(gcc 11.4.0)
結果
WA  
実行時間 -
コード長 291 bytes
コンパイル時間 753 ms
コンパイル使用メモリ 20,316 KB
実行使用メモリ 4,348 KB
最終ジャッジ日時 2023-10-21 18:36:11
合計ジャッジ時間 1,450 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,348 KB
testcase_01 WA -
testcase_02 WA -
testcase_03 WA -
testcase_04 AC 1 ms
4,348 KB
testcase_05 AC 1 ms
4,348 KB
testcase_06 WA -
testcase_07 WA -
testcase_08 AC 0 ms
4,348 KB
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 AC 0 ms
4,348 KB
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 AC 0 ms
4,348 KB
testcase_20 WA -
testcase_21 WA -
testcase_22 WA -
testcase_23 WA -
testcase_24 AC 0 ms
4,348 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.c: In function ‘main’:
main.c:5:3: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
    5 |   scanf("%d",&n);
      |   ^~~~~~~~~~~~~~
main.c:11:5: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   11 |     scanf("%d",&num_leg);
      |     ^~~~~~~~~~~~~~~~~~~~

ソースコード

diff #

#include<stdio.h>
int main(void)
{
  int n;
  scanf("%d",&n);
  int sum_kame=0;
  int sum_turu=0;
  int i;
  int num_leg;
  for(i=0;i<n;i++){
    scanf("%d",&num_leg);
    if(num_leg==2){sum_kame++;}//亀
    else{sum_turu++;}//鶴
  }
  printf("%d %d\n",sum_kame,sum_turu);
  return 0;
}


0