結果

問題 No.313 π
ユーザー LogicR_pimanLogicR_piman
提出日時 2016-10-21 02:08:06
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 14 ms / 5,000 ms
コード長 887 bytes
コンパイル時間 453 ms
コンパイル使用メモリ 58,088 KB
実行使用メモリ 4,384 KB
最終ジャッジ日時 2023-08-15 09:41:08
合計ジャッジ時間 2,257 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 13 ms
4,380 KB
testcase_01 AC 13 ms
4,380 KB
testcase_02 AC 13 ms
4,380 KB
testcase_03 AC 13 ms
4,376 KB
testcase_04 AC 13 ms
4,380 KB
testcase_05 AC 13 ms
4,376 KB
testcase_06 AC 13 ms
4,376 KB
testcase_07 AC 13 ms
4,380 KB
testcase_08 AC 13 ms
4,380 KB
testcase_09 AC 14 ms
4,376 KB
testcase_10 AC 13 ms
4,376 KB
testcase_11 AC 13 ms
4,380 KB
testcase_12 AC 13 ms
4,376 KB
testcase_13 AC 13 ms
4,380 KB
testcase_14 AC 13 ms
4,380 KB
testcase_15 AC 13 ms
4,380 KB
testcase_16 AC 13 ms
4,380 KB
testcase_17 AC 13 ms
4,384 KB
testcase_18 AC 13 ms
4,380 KB
testcase_19 AC 13 ms
4,380 KB
testcase_20 AC 13 ms
4,376 KB
testcase_21 AC 13 ms
4,376 KB
testcase_22 AC 13 ms
4,376 KB
testcase_23 AC 13 ms
4,376 KB
testcase_24 AC 13 ms
4,376 KB
testcase_25 AC 13 ms
4,376 KB
testcase_26 AC 13 ms
4,376 KB
testcase_27 AC 13 ms
4,380 KB
testcase_28 AC 13 ms
4,376 KB
testcase_29 AC 13 ms
4,376 KB
testcase_30 AC 13 ms
4,376 KB
testcase_31 AC 13 ms
4,380 KB
testcase_32 AC 13 ms
4,380 KB
testcase_33 AC 13 ms
4,380 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:53:25: warning: ‘ansb’ may be used uninitialized in this function [-Wmaybe-uninitialized]
  cout << ansa << " " << ansb << endl;
                         ^~~~
main.cpp:53:18: warning: ‘ansa’ may be used uninitialized in this function [-Wmaybe-uninitialized]
  cout << ansa << " " << ansb << endl;
                  ^~~

ソースコード

diff #

#include<iostream>
#include<string>
#include<math.h>

using namespace std;

int main() {
	int i = 0, n[10]{ 0 }, m[10]{ 0 }, ansa, ansb;
	char s[200002];
	
	for (i = 0; i < 200002; i++) {
		cin >> s[i];
	}

	//cout << s << endl;

	for (i = 0; i < 200002; i++) {
		if (s[i] == '0') n[0]++;
		if (s[i] == '1') n[1]++;
		if (s[i] == '2') n[2]++;
		if (s[i] == '3') n[3]++;
		if (s[i] == '4') n[4]++;
		if (s[i] == '5') n[5]++;
		if (s[i] == '6') n[6]++;
		if (s[i] == '7') n[7]++;
		if (s[i] == '8') n[8]++;
		if (s[i] == '9') n[9]++;
		//if (s[i] == '\0') break;
	}

	m[0] = 20104;
	m[1] = 20063;
	m[2] = 19892;
	m[3] = 20011;
	m[4] = 19874;
	m[5] = 20199;
	m[6] = 19898;
	m[7] = 20163;
	m[8] = 19956;
	m[9] = 19841;



	for (i = 0; i < 10; i++) {
		if (n[i] == m[i] + 1) {
			ansa = i;
		}
		if (n[i] == m[i] - 1) {
			ansb = i;
		}
	}

	cout << ansa << " " << ansb << endl;

	return 0;
}
0