結果

問題 No.2748 Strange Clock
ユーザー tailstails
提出日時 2024-04-28 23:43:18
言語 C90
(gcc 11.4.0)
結果
AC  
実行時間 1 ms / 2,000 ms
コード長 2,278 bytes
コンパイル時間 549 ms
コンパイル使用メモリ 23,168 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-04-28 23:43:20
合計ジャッジ時間 1,554 ms
ジャッジサーバーID
(参考情報)
judge3 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 0 ms
5,248 KB
testcase_01 AC 1 ms
5,376 KB
testcase_02 AC 0 ms
5,376 KB
testcase_03 AC 0 ms
5,376 KB
testcase_04 AC 0 ms
5,376 KB
testcase_05 AC 1 ms
5,376 KB
testcase_06 AC 1 ms
5,376 KB
testcase_07 AC 0 ms
5,376 KB
testcase_08 AC 1 ms
5,376 KB
testcase_09 AC 0 ms
5,376 KB
testcase_10 AC 1 ms
5,376 KB
testcase_11 AC 0 ms
5,376 KB
testcase_12 AC 1 ms
5,376 KB
testcase_13 AC 0 ms
5,376 KB
testcase_14 AC 0 ms
5,376 KB
testcase_15 AC 0 ms
5,376 KB
testcase_16 AC 0 ms
5,376 KB
testcase_17 AC 1 ms
5,376 KB
testcase_18 AC 0 ms
5,376 KB
testcase_19 AC 0 ms
5,376 KB
testcase_20 AC 0 ms
5,376 KB
testcase_21 AC 1 ms
5,376 KB
testcase_22 AC 0 ms
5,376 KB
testcase_23 AC 1 ms
5,376 KB
testcase_24 AC 0 ms
5,376 KB
testcase_25 AC 0 ms
5,376 KB
testcase_26 AC 0 ms
5,376 KB
testcase_27 AC 0 ms
5,376 KB
testcase_28 AC 0 ms
5,376 KB
testcase_29 AC 1 ms
5,376 KB
testcase_30 AC 1 ms
5,376 KB
testcase_31 AC 1 ms
5,376 KB
testcase_32 AC 0 ms
5,376 KB
testcase_33 AC 0 ms
5,376 KB
testcase_34 AC 0 ms
5,376 KB
testcase_35 AC 0 ms
5,376 KB
testcase_36 AC 0 ms
5,376 KB
testcase_37 AC 0 ms
5,376 KB
testcase_38 AC 1 ms
5,376 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.c: In function ‘main’:
main.c:143:9: warning: implicit declaration of function ‘read’ [-Wimplicit-function-declaration]
  143 |         read(0,rbuf,sizeof rbuf);
      |         ^~~~
main.c:158:9: warning: implicit declaration of function ‘write’ [-Wimplicit-function-declaration]
  158 |         write(1,b[n][i],8);
      |         ^~~~~
main.c:159:9: warning: implicit declaration of function ‘_exit’ [-Wimplicit-function-declaration]
  159 |         _exit(0);
      |         ^~~~~
main.c:159:9: warning: incompatible implicit declaration of built-in function ‘_exit’ [-Wbuiltin-declaration-mismatch]

ソースコード

diff #

#pragma GCC optimize("Ofast")
#pragma GCC target("avx2")

const long a[][10]={
	{},
	{10,1},
	{142,1},
	{1726,1438,286,1},
	{20734,15262,5470,1},
	{248830,233566,207358,192094,41470,26206,15262,1},
	{2985982,2721886,2280958,2016862,705022,264094,1},
	{35831806,29859838,26609758,20637790,9222046,5971966,3250078,1},
	{429981694,349096030,247572574,235628638,194353054,182409118,80885662,1},
	{5159780350,4299816958,859963390,1},
	{61917364222,45578059774,16339304446,1},
	{743008370686,619173642238,123834728446,1},
	{8916100448254,6810910064638,2105190383614,1},
	{106993205379070,89161004482558,17832200896510,1},
	{1283918464548862,1},
	{15407021574586366,12839184645488638,2567836929097726,1},
};
const char b[][10][8]={
	{
	},
	{
		"       0",
		"       1",
		"       3",
	},
	{
		"       0",
		"       3",
		"       9",
	},
	{
		"       0",
		"       3",
		"       6",
		"       9",
		"      27",
	},
	{
		"       0",
		"      15",
		"      21",
		"      27",
		"      81",
	},
	{
		"       0",
		"      15",
		"      21",
		"      36",
		"      42",
		"      57",
		"      63",
		"      81",
		"     243",
	},
	{
		"       0",
		"     111",
		"     117",
		"     159",
		"     171",
		"     225",
		"     243",
		"     729",
	},
	{
		"       0",
		"     207",
		"     414",
		"     432",
		"     450",
		"     468",
		"     711",
		"     729",
		"    2187",
	},
	{
		"       0",
		"    1899",
		"    2007",
		"    2025",
		"    2043",
		"    2061",
		"    2079",
		"    2187",
		"    6561",
	},
	{
		"       0",
		"    2187",
		"    4374",
		"    6561",
		"   19683",
	},
	{
		"       0",
		"   10935",
		"   15309",
		"   19683",
		"   59049",
	},
	{
		"       0",
		"   19683",
		"   39366",
		"   59049",
		"  177147",
	},
	{
		"       0",
		"   98415",
		"  137781",
		"  177147",
		"  531441",
	},
	{
		"       0",
		"  177147",
		"  354294",
		"  531441",
		" 1594323",
	},
	{
		"       0",
		" 1594323",
		" 4782969",
	},
	{
		"       0",
		" 1594323",
		" 3188646",
		" 4782969",
		"14348907",
	},
};

int main(){
	char rbuf[64];
	read(0,rbuf,sizeof rbuf);
	char*rp=rbuf;
	int n=*rp++-'0';
	if(*rp>='0'){
		n=*rp++-'0'+10;
	}
	++rp;
	long m=0;
	for(int c;c=*rp++-'0',c>=0;){
		m=m*10+c;
	}
	int i=0;
	while(m<a[n][i]){
		++i;
	}
	write(1,b[n][i],8);
	_exit(0);
}
0