結果

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

テストケース

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

ソースコード

diff #

#include<stdio.h>

//入力が異なったら小さいほうが亀,大きい方が鶴
//入力が全て等しければnで割って4なら亀,2ならば鶴

int main(void)
{
  int i;
  int n;
  int sum_kame=0;
  int sum_tsuru=0;
  scanf("%d",&n);
  int a[n];//それぞれの足の数を含めない総数

  for(i=0;i<n;i++){
    scanf("%d",&a[i]);
  }

  for(i=0;i<n;i++){
    if(2*a[i]%(2*n-4)==0){
      sum_kame++;
    }
  }
  sum_tsuru=n-sum_kame;
  printf("%d %d\n",sum_kame,sum_tsuru);
  return 0;
}



0