結果
問題 | No.349 干支の置き物 |
ユーザー |
![]() |
提出日時 | 2016-03-11 23:59:58 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
AC
|
実行時間 | 2 ms / 2,000 ms |
コード長 | 836 bytes |
コンパイル時間 | 791 ms |
コンパイル使用メモリ | 92,852 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-11-17 07:24:37 |
合計ジャッジ時間 | 1,649 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 29 |
コンパイルメッセージ
main.cpp: In function ‘int main()’: main.cpp:26:14: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 26 | scanf("%d", &n); | ~~~~~^~~~~~~~~~
ソースコード
#define _CRT_SECURE_NO_WARNINGS #define _USE_MATH_DEFINES #include <stdio.h> #include <algorithm> #include <utility> #include <functional> #include <cstring> #include <queue> #include <stack> #include <math.h> #include <iterator> #include <iomanip> #include <vector> #include <string> #include <set> #include <math.h> #include <iostream> #include<map> #include <list> #include <typeinfo> using namespace std; #define REP(a,b) for(long long a = 0;a < b;++a) map<string, int> hoge; int main() { int n; scanf("%d", &n); REP(i, n) { string a; cin >> a; hoge[a]++; } int ans = 0; for (auto itr = hoge.begin();itr != hoge.end();++itr) { ans = max(ans, itr->second); } int mom = n / 2; if (n % 2 == 1) mom++; if (mom >= ans) { cout << "YES" << endl; } else { cout << "NO" << endl; } } //thank you for reading my code!