結果
問題 | No.313 π |
ユーザー |
![]() |
提出日時 | 2016-02-14 10:04:51 |
言語 | C++11 (gcc 13.3.0) |
結果 |
RE
|
実行時間 | - |
コード長 | 563 bytes |
コンパイル時間 | 632 ms |
コンパイル使用メモリ | 64,388 KB |
実行使用メモリ | 6,948 KB |
最終ジャッジ日時 | 2024-09-22 06:22:10 |
合計ジャッジ時間 | 5,458 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | RE * 2 |
other | RE * 32 |
コンパイルメッセージ
main.cpp: In function ‘int main()’: main.cpp:32:23: warning: ‘b’ may be used uninitialized in this function [-Wmaybe-uninitialized] 32 | cout << a << " " << b << endl; | ^ main.cpp:32:16: warning: ‘a’ may be used uninitialized in this function [-Wmaybe-uninitialized] 32 | 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 ) { 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; }