結果
問題 | No.313 π |
ユーザー |
![]() |
提出日時 | 2016-10-21 01:43:49 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
AC
|
実行時間 | 16 ms / 5,000 ms |
コード長 | 729 bytes |
コンパイル時間 | 470 ms |
コンパイル使用メモリ | 61,164 KB |
実行使用メモリ | 6,820 KB |
最終ジャッジ日時 | 2024-11-23 15:58:41 |
合計ジャッジ時間 | 2,007 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 32 |
コンパイルメッセージ
main.cpp: In function ‘int main()’: main.cpp:34:25: warning: ‘much’ may be used uninitialized in this function [-Wmaybe-uninitialized] 34 | cout << much << " " << little << endl; | ^~~ main.cpp:34:32: warning: ‘little’ may be used uninitialized in this function [-Wmaybe-uninitialized] 34 | cout << much << " " << little << endl; | ^~~~~~
ソースコード
#include <iostream>#include <math.h>#include <string>#include <algorithm>using namespace std;int main(){char s;int little, much;int ans[10] = { 20104, 20063, 19892, 20011, 19874, 20199, 19898, 20163, 19956, 19841 };int cnt[10] = { 0 };for (int i = 0; i < 200002; i++){cin >> s;if (s == '0') cnt[0]++;if (s == '1') cnt[1]++;if (s == '2') cnt[2]++;if (s == '3') cnt[3]++;if (s == '4') cnt[4]++;if (s == '5') cnt[5]++;if (s == '6') cnt[6]++;if (s == '7') cnt[7]++;if (s == '8') cnt[8]++;if (s == '9') cnt[9]++;}for (int i = 0; i < 10; i++){if (cnt[i]>ans[i]){much = i;}if (cnt[i]<ans[i]){little = i;}}cout << much << " " << little << endl;return 0;}