結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 WA -
testcase_02 WA -
testcase_03 WA -
testcase_04 WA -
testcase_05 AC 0 ms
4,348 KB
testcase_06 WA -
testcase_07 WA -
testcase_08 AC 1 ms
4,348 KB
testcase_09 WA -
testcase_10 AC 0 ms
4,348 KB
testcase_11 WA -
testcase_12 WA -
testcase_13 AC 1 ms
4,348 KB
testcase_14 WA -
testcase_15 AC 1 ms
4,348 KB
testcase_16 WA -
testcase_17 AC 1 ms
4,348 KB
testcase_18 WA -
testcase_19 AC 0 ms
4,348 KB
testcase_20 WA -
testcase_21 AC 0 ms
4,348 KB
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-2)==0){
      sum_tsuru++;
    }
  }
  sum_kame=n-sum_tsuru;
  printf("%d %d\n",sum_kame,sum_tsuru);
  return 0;
}



0