結果

問題 No.313 π
ユーザー bal4ubal4u
提出日時 2019-06-20 07:29:09
言語 C
(gcc 12.3.0)
結果
AC  
実行時間 2 ms / 5,000 ms
コード長 729 bytes
コンパイル時間 1,191 ms
コンパイル使用メモリ 28,764 KB
実行使用メモリ 4,384 KB
最終ジャッジ日時 2023-08-21 14:42:08
合計ジャッジ時間 2,744 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,376 KB
testcase_01 AC 1 ms
4,376 KB
testcase_02 AC 0 ms
4,376 KB
testcase_03 AC 1 ms
4,380 KB
testcase_04 AC 1 ms
4,384 KB
testcase_05 AC 1 ms
4,380 KB
testcase_06 AC 1 ms
4,376 KB
testcase_07 AC 0 ms
4,380 KB
testcase_08 AC 1 ms
4,380 KB
testcase_09 AC 0 ms
4,380 KB
testcase_10 AC 1 ms
4,380 KB
testcase_11 AC 1 ms
4,376 KB
testcase_12 AC 1 ms
4,380 KB
testcase_13 AC 1 ms
4,376 KB
testcase_14 AC 1 ms
4,376 KB
testcase_15 AC 1 ms
4,376 KB
testcase_16 AC 1 ms
4,376 KB
testcase_17 AC 1 ms
4,380 KB
testcase_18 AC 1 ms
4,380 KB
testcase_19 AC 1 ms
4,376 KB
testcase_20 AC 1 ms
4,376 KB
testcase_21 AC 1 ms
4,376 KB
testcase_22 AC 1 ms
4,376 KB
testcase_23 AC 1 ms
4,376 KB
testcase_24 AC 1 ms
4,380 KB
testcase_25 AC 2 ms
4,380 KB
testcase_26 AC 1 ms
4,376 KB
testcase_27 AC 2 ms
4,380 KB
testcase_28 AC 1 ms
4,376 KB
testcase_29 AC 1 ms
4,380 KB
testcase_30 AC 1 ms
4,380 KB
testcase_31 AC 1 ms
4,376 KB
testcase_32 AC 2 ms
4,376 KB
testcase_33 AC 1 ms
4,380 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.c: 関数 ‘main’ 内:
main.c:7:14: 警告: 関数 ‘getchar_unlocked’ の暗黙的な宣言です [-Wimplicit-function-declaration]
    7 | #define gc() getchar_unlocked()
      |              ^~~~~~~~~~~~~~~~
main.c:22:18: 備考: in expansion of macro ‘gc’
   22 |         if ((c = gc()) != '3') { pc(c), puts(" 3"); return 0; }
      |                  ^~
main.c:8:15: 警告: 関数 ‘putchar_unlocked’ の暗黙的な宣言です [-Wimplicit-function-declaration]
    8 | #define pc(c) putchar_unlocked(c)
      |               ^~~~~~~~~~~~~~~~
main.c:22:34: 備考: in expansion of macro ‘pc’
   22 |         if ((c = gc()) != '3') { pc(c), puts(" 3"); return 0; }
      |                                  ^~

ソースコード

diff #

// yukicoder: No.313 π
// 2019.6.20 bal4u

#include <stdio.h>

#if 1
#define gc() getchar_unlocked()
#define pc(c) putchar_unlocked(c)
#else
#define gc() getchar()
#define pc(c) putchar(c)
#endif

int ans[10] = {
20104, 20063, 19892, 20010, 19874, 20199, 19898, 20163, 19956, 19841 };
int f[10];

int main()
{
	int n, c, a, b;
	
	if ((c = gc()) != '3') { pc(c), puts(" 3"); return 0; }
	gc(); // skip '.'
	n = 200000; while (n--) {
		do c = gc();
		while (c < '0');
		f[c & 0xf]++;
	}
#if 0  // get answer
	for (c = 0; c < 10; c++) printf("%d, ", f[c]); printf("\n");
#else
	for (c = 0; c < 10; c++) {
		if (f[c] < ans[c]) b = c;
		else if (f[c] > ans[c]) a = c;
	}
	pc('0'+a), pc(' '), pc('0'+b), pc('\n');
#endif
	return 0;
}
0