結果

問題 No.313 π
コンテスト
ユーザー waruo
提出日時 2015-12-07 16:04:05
言語 C++11
(gcc 15.2.0 + boost 1.89.0)
コンパイル:
g++-15 -O2 -lm -std=gnu++11 -Wuninitialized -DONLINE_JUDGE -o a.out _filename_
実行:
./a.out
結果
AC  
実行時間 5 ms / 5,000 ms
コード長 440 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 560 ms
コンパイル使用メモリ 75,736 KB
実行使用メモリ 6,400 KB
最終ジャッジ日時 2026-04-04 14:14:53
合計ジャッジ時間 1,258 ms
ジャッジサーバーID
(参考情報)
judge3_1 / judge1_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 32
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp: In function 'int main()':
main.cpp:11:16: warning: 'f' may be used uninitialized [-Wmaybe-uninitialized]
   11 |         int t, f;
      |                ^
main.cpp:11:13: warning: 't' may be used uninitialized [-Wmaybe-uninitialized]
   11 |         int t, f;
      |             ^

ソースコード

diff #
raw source code

#include <iostream>
#include <string>
#include <fstream>
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;
	return 0;
}
0