結果
| 問題 |
No.2714 Amaou
|
| コンテスト | |
| ユーザー |
tnakao0123
|
| 提出日時 | 2024-04-30 11:39:38 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 134 ms / 2,000 ms |
| コード長 | 736 bytes |
| コンパイル時間 | 482 ms |
| コンパイル使用メモリ | 62,476 KB |
| 最終ジャッジ日時 | 2025-02-21 09:53:05 |
|
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 26 |
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:30:8: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
30 | scanf("%d", &n);
| ~~~~~^~~~~~~~~~
main.cpp:37:12: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
37 | scanf("%s", t);
| ~~~~~^~~~~~~~~
ソースコード
/* -*- coding: utf-8 -*-
*
* 2714.cc: No.2714 Amaou - yukicoder
*/
#include<cstdio>
#include<string>
#include<algorithm>
using namespace std;
/* constant */
const int K = 4;
const int KBITS = 1 << K;
const int MAX_L = 5;
const string ss[K] = { "akai", "marui", "okii", "umai" };
/* typedef */
/* global variables */
/* subroutines */
/* main */
int main() {
int n;
scanf("%d", &n);
int cnt = 0;
for (int i = 0; i < n; i++) {
int bits = 0;
for (int j = 0; j < K; j++) {
char t[MAX_L + 4];
scanf("%s", t);
string sj(t);
for (int k = 0; k < K; k++)
if (sj == ss[k]) { bits |= (1 << k); break; }
}
if (bits == KBITS - 1) cnt++;
}
printf("%d\n", cnt);
return 0;
}
tnakao0123