結果
問題 | No.313 π |
ユーザー |
![]() |
提出日時 | 2016-02-14 10:07:15 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
AC
|
実行時間 | 6 ms / 5,000 ms |
コード長 | 602 bytes |
コンパイル時間 | 759 ms |
コンパイル使用メモリ | 63,844 KB |
実行使用メモリ | 6,944 KB |
最終ジャッジ日時 | 2024-09-22 06:22:13 |
合計ジャッジ時間 | 2,104 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 32 |
コンパイルメッセージ
main.cpp: In function ‘int main()’: main.cpp:35:23: warning: ‘b’ may be used uninitialized in this function [-Wmaybe-uninitialized] 35 | cout << a << " " << b << endl; | ^ main.cpp:35:16: warning: ‘a’ may be used uninitialized in this function [-Wmaybe-uninitialized] 35 | cout << a << " " << b << endl; | ^~~
ソースコード
#include <iostream>#include <vector>#include <algorithm>using namespace std;int main(){vector<int> hist_ans = {20104, 20063, 19892, 20011, 19874, 20199, 19898, 20163, 19956, 19841};vector<int> hist_in( 10 );fill( hist_in.begin(), hist_in.end(), 0 );string line;getline( cin, line );for ( char ch : line ){if ( '0' <= ch && ch <= '9' ){hist_in[ ch - '0' ]++;}}int a, b;for ( int i = 0; i <= 9; i++ ){if ( hist_ans[ i ] < hist_in[ i ] ){a = i;}else if ( hist_ans[ i ] > hist_in[ i ] ){b = i;}}cout << a << " " << b << endl;}