結果
問題 |
No.313 π
|
ユーザー |
|
提出日時 | 2021-01-12 19:55:08 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 3 ms / 5,000 ms |
コード長 | 1,498 bytes |
コンパイル時間 | 2,847 ms |
コンパイル使用メモリ | 130,536 KB |
最終ジャッジ日時 | 2025-01-17 16:44:19 |
ジャッジサーバーID (参考情報) |
judge4 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 32 |
コンパイルメッセージ
main.cpp: In function ‘int main()’: main.cpp:68:14: warning: ‘ans2’ is used uninitialized [-Wuninitialized] 68 | int ans, ans2; | ^~~~ main.cpp:68:9: warning: ‘ans’ is used uninitialized [-Wuninitialized] 68 | int ans, ans2; | ^~~
ソースコード
#include <iostream> #include <vector> #include <algorithm> #include <cmath> #include <queue> #include <string> #include <map> #include <set> #include <stack> #include <tuple> #include <deque> #include <array> #include <numeric> #include <bitset> #include <iomanip> #include <cassert> #include <chrono> #include <random> #include <limits> #include <iterator> #include <functional> #include <sstream> #include <fstream> #include <complex> #include <cstring> #include <unordered_map> #include <unordered_set> using namespace std; using ll = long long; using P = pair<int, int>; constexpr int INF = 1001001001; // constexpr int mod = 1000000007; constexpr int mod = 998244353; template<class T> inline bool chmax(T& x, T y){ if(x < y){ x = y; return true; } return false; } template<class T> inline bool chmin(T& x, T y){ if(x > y){ x = y; return true; } return false; } constexpr int cnt[10] = {20104, 20063, 19892, 20011, 19874, 20199, 19898, 20163, 19956, 19841}; int main(){ ios::sync_with_stdio(false); cin.tie(nullptr); string s; cin >> s; vector<int> cnt2(10); int n = s.length(); for(int i = 0; i < n; ++i){ if(s[i] == '.') continue; cnt2[s[i] - '0'] += 1; } int ans, ans2; for(int i = 0; i < 10; ++i){ if(cnt[i] > cnt2[i]) ans = i; else if(cnt[i] < cnt2[i]) ans2 = i; } cout << ans2 << ' ' << ans << '\n'; return 0; }