結果

問題 No.313 π
ユーザー hanorver
提出日時 2015-12-28 21:00:34
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
AC  
実行時間 6 ms / 5,000 ms
コード長 478 bytes
コンパイル時間 387 ms
コンパイル使用メモリ 59,324 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-09-19 07:57:31
合計ジャッジ時間 1,502 ms
ジャッジサーバーID
(参考情報)
judge4 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 32
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp: In function ‘int main(int, char**)’:
main.cpp:22:35: warning: ‘ca’ may be used uninitialized in this function [-Wmaybe-uninitialized]
   22 |         std::cout << wa << " " << ca << std::endl;
      |                                   ^~
main.cpp:22:28: warning: ‘wa’ may be used uninitialized in this function [-Wmaybe-uninitialized]
   22 |         std::cout << wa << " " << ca << std::endl;
      |                            ^~~

ソースコード

diff #

#include<iostream>
#include<string>
#include<algorithm>

int main(int argc, char **argv) {
	int num[10] = { 20104, 20063, 19892, 20011, 19874, 20199, 19898, 20163, 19956, 19841 };

	std::string str;
	std::cin >> str;

	for (size_t i = 0; i < str.length(); i++) {
		if (str[i] == '.')continue;
		num[str[i] - '0']--;
	}

	int wa, ca;
	for (int i = 0; i < 10; i++) {
		if (num[i] == -1)wa = i;
		if (num[i] == 1)ca = i;
	}

	std::cout << wa << " " << ca << std::endl;
	return 0;
}
0