結果

問題 No.29 パワーアップ
ユーザー satanic
提出日時 2015-11-23 19:58:29
言語 C90
(gcc 12.3.0)
結果
AC  
実行時間 1 ms / 5,000 ms
コード長 443 bytes
コンパイル時間 200 ms
コンパイル使用メモリ 21,120 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-09-13 17:17:26
合計ジャッジ時間 1,021 ms
ジャッジサーバーID
(参考情報)
judge1 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 22
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.c: In function ‘main’:
main.c:9:3: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
    9 |   scanf("%d", &n);
      |   ^~~~~~~~~~~~~~~
main.c:12:7: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   12 |       scanf("%d", &input);
      |       ^~~~~~~~~~~~~~~~~~~

ソースコード

diff #

#include <stdio.h>

int main(){
  int item[10]={0};
  int n, input;
  int i, j, rest=0;
  int powup_cnt=0;

  scanf("%d", &n);
  for(i=0; i<n; ++i){
    for(j=0; j<3; ++j){
      scanf("%d", &input);
      ++item[input%10];
    }
  }  
  for(i=0; i<10; ++i){
    while(item[i]>=2){
      item[i]-=2;
      ++powup_cnt;
    }
    rest+=item[i];
  }
  while(rest>=4){
    rest-=4;
    ++powup_cnt;
  }
  printf("%d\n", powup_cnt);

  return 0;
}
0