結果

問題 No.2153 何コーダーが何人?
コンテスト
ユーザー chro_96
提出日時 2022-12-10 00:14:33
言語 C(gnu17)
(gcc 15.2.0)
コンパイル:
gcc-15 -O2 -std=gnu17 -Wno-error=implicit-function-declaration -Wno-error=implicit-int -DONLINE_JUDGE -o a.out _filename_ -lm
実行:
./a.out
結果
AC  
実行時間 4 ms / 2,000 ms
コード長 601 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 168 ms
コンパイル使用メモリ 38,016 KB
最終ジャッジ日時 2026-02-22 09:53:24
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 19
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

#include <stdio.h>
#include <string.h>

int main () {
  int n = 0;
  char s[2000][201] = {};
  int c[2000] = {};
  
  int res = 0;
  
  int ans[8] = {};
  
  res = scanf("%d", &n);
  for (int i = 0; i < n; i++) {
    res = scanf("%s", s[i]);
    res = scanf("%d", c+i);
  }
  
  for (int i = 0; i < n; i++) {
    int idx = i+1;
    int is_ok = 1;
    while (idx < n && is_ok > 0) {
      if (strcmp(s[i], s[idx]) == 0) {
        is_ok = 0;
      }
      idx++;
    }
    if (is_ok > 0) {
      ans[c[i]]++;
    }
  }
  
  for (int i = 0; i < 8; i++) {
    printf("%d\n", ans[i]);
  }
  
  return 0;
}
0