結果

問題 No.112 ややこしい鶴亀算
ユーザー umashika
提出日時 2016-02-02 00:07:29
言語 C90
(gcc 12.3.0)
結果
WA  
実行時間 -
コード長 291 bytes
コンパイル時間 156 ms
コンパイル使用メモリ 20,096 KB
実行使用メモリ 6,948 KB
最終ジャッジ日時 2024-09-21 19:56:18
合計ジャッジ時間 943 ms
ジャッジサーバーID
(参考情報)
judge4 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1 WA * 1
other AC * 6 WA * 17
権限があれば一括ダウンロードができます
コンパイルメッセージ
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