結果

問題 No.313 π
ユーザー fiord
提出日時 2015-12-13 11:30:44
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
AC  
実行時間 6 ms / 5,000 ms
コード長 379 bytes
コンパイル時間 1,265 ms
コンパイル使用メモリ 158,432 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-09-15 11:34:48
合計ジャッジ時間 2,735 ms
ジャッジサーバーID
(参考情報)
judge2 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 32
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:16:23: warning: ‘b’ may be used uninitialized in this function [-Wmaybe-uninitialized]
   16 |         cout<<a<<" "<<b<<endl;
      |                       ^
main.cpp:16:18: warning: ‘a’ may be used uninitialized in this function [-Wmaybe-uninitialized]
   16 |         cout<<a<<" "<<b<<endl;
      |                  ^~~

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
int main(){
	string s;	cin>>s;
	int cnt[10]={};
	for(int i=0;i<(int)s.size();i++){
		if(s[i]!='.')	cnt[s[i]-'0']++;
	}
	int cor[]={20104,20063,19892,20011,19874,
				20199,19898,20163,19956,19841};
	int a,b;
	for(int i=0;i<10;i++){
		if(cor[i]+1==cnt[i])	a=i;
		else if(cor[i]==cnt[i]+1)	b=i;
	}
	cout<<a<<" "<<b<<endl;
	return 0;
}
0