結果

問題 No.313 π
ユーザー waruowaruo
提出日時 2015-12-07 16:07:22
言語 C++11
(gcc 13.3.0)
結果
AC  
実行時間 6 ms / 5,000 ms
コード長 358 bytes
コンパイル時間 424 ms
コンパイル使用メモリ 56,112 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-09-14 18:20:10
合計ジャッジ時間 1,671 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 32
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:7:23: warning: ‘f’ may be used uninitialized in this function [-Wmaybe-uninitialized]
    7 |         std::cout<<f<<" "<<t<<std::endl;
      |                       ^~~
main.cpp:7:28: warning: ‘t’ may be used uninitialized in this function [-Wmaybe-uninitialized]
    7 |         std::cout<<f<<" "<<t<<std::endl;
      |                            ^

ソースコード

diff #

#include <iostream>
#include <string>
int main(){int b[10]={20104,20063,19892,20011,19874,20199,19898,20163,19956,19841,};std::string s;std::cin >> s;int n[10] = {0};
	for(const char c : s){if(c != '.' && (c >= '0' && c <= '9'))n[c - '0']++;}
	int t, f;
	for(int i=0;i<10;i++){if(n[i]==b[i]+1){f=i;}if(n[i]==b[i]-1){t=i;}}
	std::cout<<f<<" "<<t<<std::endl;
}
0