結果
問題 | No.313 π |
ユーザー |
![]() |
提出日時 | 2015-12-07 00:31:20 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
AC
|
実行時間 | 6 ms / 5,000 ms |
コード長 | 930 bytes |
コンパイル時間 | 1,275 ms |
コンパイル使用メモリ | 160,044 KB |
実行使用メモリ | 5,376 KB |
最終ジャッジ日時 | 2024-09-14 17:08:06 |
合計ジャッジ時間 | 2,609 ms |
ジャッジサーバーID (参考情報) |
judge6 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 32 |
コンパイルメッセージ
main.cpp: In function ‘void solve()’: main.cpp:39:29: warning: ‘r’ may be used uninitialized in this function [-Wmaybe-uninitialized] 39 | cout << w << " " << r << endl; | ^ main.cpp:39:22: warning: ‘w’ may be used uninitialized in this function [-Wmaybe-uninitialized] 39 | cout << w << " " << r << endl; | ^~~
ソースコード
#define _USE_MATH_DEFINES #define _CRT_SECURE_NO_WARNINGS #include "bits/stdc++.h" #define rep(i,n) for(int i = 0;i < n;i++) #define REP(i,n,k) for(int i = n;i < k;i++) #define P(p) cout<<(p)<<endl; #define pi 3.1415926535 using namespace std; typedef long long ll; int dx[] = { 0, 1, 0, -1 }; int dy[] = { -1, 0, 1, 0 }; unsigned long long sttoi(std::string str) { unsigned long long ret; std::stringstream ss; ss << str; ss >> ret; return ret; } string s; void solve() { int nums[] = { 20104, 20063, 19892, 20011, 19874, 20199, 19898, 20163, 19956, 19841 }; int cnt[10]; fill(cnt, cnt + 10, 0); cin >> s; for (int i = 0; i < s.length(); i++){ if ('0' <= s[i] && s[i] <= '9' && s[i] != '.'){ cnt[s[i] - '0']++; } } int w, r; for (int i = 0; i < 10; i++){ if (cnt[i] < nums[i]){ r = i; } if (cnt[i] > nums[i]){ w = i; } } cout << w << " " << r << endl; } int main() { solve(); return 0; }