結果
| 問題 |
No.313 π
|
| コンテスト | |
| ユーザー |
Lay_ec
|
| 提出日時 | 2015-12-07 15:00:27 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
AC
|
| 実行時間 | 6 ms / 5,000 ms |
| コード長 | 677 bytes |
| コンパイル時間 | 786 ms |
| コンパイル使用メモリ | 81,672 KB |
| 実行使用メモリ | 6,944 KB |
| 最終ジャッジ日時 | 2024-09-14 18:19:35 |
| 合計ジャッジ時間 | 2,164 ms |
|
ジャッジサーバーID (参考情報) |
judge6 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 32 |
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:39:23: warning: ‘r’ may be used uninitialized in this function [-Wmaybe-uninitialized]
39 | cout<<w<<" "<<r<<endl;
| ^
main.cpp:39:18: warning: ‘w’ may be used uninitialized in this function [-Wmaybe-uninitialized]
39 | cout<<w<<" "<<r<<endl;
| ^~~
ソースコード
#include <iostream>
#include <string>
#include <vector>
#include <cmath>
#include <algorithm>
#include <cstdlib>
#include <ctime>
#include <cstdio>
#include <functional>
#include <set>
#include <sstream>
#include <map>
#include <queue>
#include <stack>
using namespace std;
typedef vector<double> vec;
typedef vector<vec> mat;
int main()
{
int pi_cnt[10]={20104,20063,19892,20011,19874,20199,19898,20163,19956,19841};
string s;
cin>>s;
int cnt[10]={};
for(int i=0;i<s.size();i++){
if(s[i]=='.') continue;
cnt[s[i]-'0']++;
}
int w,r;
for(int i=0;i<10;i++){
if(cnt[i]<pi_cnt[i]) r=i;
if(cnt[i]>pi_cnt[i]) w=i;
}
cout<<w<<" "<<r<<endl;
return 0;
}
Lay_ec