結果

問題 No.313 π
ユーザー t33f
提出日時 2019-03-16 00:12:17
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 7 ms / 5,000 ms
コード長 347 bytes
コンパイル時間 547 ms
コンパイル使用メモリ 65,256 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-07-01 22:09:13
合計ジャッジ時間 2,503 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 32
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp: In function 'int main()':
main.cpp:11:28: warning: 'to' may be used uninitialized [-Wmaybe-uninitialized]
   11 |     cout << from << " " << to << endl;
      |                            ^~
main.cpp:9:15: note: 'to' was declared here
    9 |     int from, to;
      |               ^~
main.cpp:11:21: warning: 'from' may be used uninitialized [-Wmaybe-uninitialized]
   11 |     cout << from << " " << to << endl;
      |                     ^~~
main.cpp:9:9: note: 'from' was declared here
    9 |     int from, to;
      |         ^~~~

ソースコード

diff #

#include <iostream>
using namespace std;

int cnt[] = {20104, 20063, 19892, 20011, 19874, 20199, 19898, 20163, 19956, 19841};

int main () {
    string s; cin >> s;
    for (char c : s) cnt[c-'0']--;
    int from, to;
    for (int i = 0; i < 10; i++) if (cnt[i] > 0) to = i; else if (cnt[i] < 0) from = i;
    cout << from << " " << to << endl;
}
0