結果

問題 No.1611 Minimum Multiple with Double Divisors
ユーザー tailstails
提出日時 2021-08-13 11:13:51
言語 C
(gcc 12.3.0)
結果
AC  
実行時間 8 ms / 2,000 ms
コード長 1,193 bytes
コンパイル時間 253 ms
コンパイル使用メモリ 33,664 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-04-14 05:42:16
合計ジャッジ時間 2,785 ms
ジャッジサーバーID
(参考情報)
judge4 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 8 ms
6,812 KB
testcase_01 AC 6 ms
6,944 KB
testcase_02 AC 7 ms
6,940 KB
testcase_03 AC 7 ms
6,940 KB
testcase_04 AC 7 ms
6,944 KB
testcase_05 AC 7 ms
6,940 KB
testcase_06 AC 7 ms
6,940 KB
testcase_07 AC 6 ms
6,944 KB
testcase_08 AC 7 ms
6,940 KB
testcase_09 AC 7 ms
6,944 KB
testcase_10 AC 4 ms
6,940 KB
testcase_11 AC 6 ms
6,944 KB
testcase_12 AC 7 ms
6,944 KB
testcase_13 AC 7 ms
6,944 KB
testcase_14 AC 7 ms
6,940 KB
testcase_15 AC 7 ms
6,944 KB
testcase_16 AC 7 ms
6,944 KB
testcase_17 AC 7 ms
6,940 KB
testcase_18 AC 7 ms
6,944 KB
testcase_19 AC 1 ms
6,940 KB
testcase_20 AC 1 ms
6,940 KB
testcase_21 AC 1 ms
6,940 KB
testcase_22 AC 1 ms
6,940 KB
testcase_23 AC 1 ms
6,944 KB
testcase_24 AC 1 ms
6,944 KB
testcase_25 AC 1 ms
6,940 KB
testcase_26 AC 1 ms
6,944 KB
testcase_27 AC 1 ms
6,940 KB
testcase_28 AC 1 ms
6,940 KB
testcase_29 AC 1 ms
6,944 KB
testcase_30 AC 1 ms
6,944 KB
testcase_31 AC 1 ms
6,940 KB
testcase_32 AC 1 ms
6,940 KB
testcase_33 AC 1 ms
6,944 KB
testcase_34 AC 1 ms
6,944 KB
testcase_35 AC 1 ms
6,940 KB
testcase_36 AC 1 ms
6,940 KB
testcase_37 AC 1 ms
6,944 KB
testcase_38 AC 1 ms
6,940 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.c:40:1: warning: return type defaults to 'int' [-Wimplicit-int]
   40 | main(){
      | ^~~~
main.c: In function 'main':
main.c:53:9: warning: implicit declaration of function 'write' [-Wimplicit-function-declaration]
   53 |         write(1,wbuf,wp-wbuf);
      |         ^~~~~
main.c:54:9: warning: implicit declaration of function '_exit'; did you mean '_Exit'? [-Wimplicit-function-declaration]
   54 |         _exit(0);
      |         ^~~~~
      |         _Exit

ソースコード

diff #

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

char*mmap();
char wbuf[1<<25];

#define rd_skip() while(*rp++>=48)
#define rd(v) long v=0;{long _c;while(_c=*rp++-48,_c>=0)v=v*10+_c;}
#define WTHI(v) {long _z=v,_n=0,_d=0;while(++_n,_d=_d<<8|0x30|_z%10,_z/=10);*(long*)wp=_d;wp+=_n;}
#define WTLO(v) {long _z=v,_n=8,_d=0;while(_d=_d<<8|0x30|_z%10,_z/=10,--_n);*(long*)wp=_d;wp+=8;}
#define wt(v) if(v>=100000000){WTHI(v/100000000);WTLO(v);}else{WTHI(v);}

long f(long x){
	if(x%2) return 2;
	if(x%3) return 3;
	if(x%4) return 4;
	if(x%5) return 5;
	if(x%8&&x%9) return 6;
	if(x%7) return 7;
	if(x%8) return 8;
	if(x%9) return 9;
	if(x%11) return 11;
	if(x%16&&x%27) return 12;
	if(x%13) return 13;
	if(x%27&&x%25) return 15;
	if(x%16) return 16;
	if(x%17) return 17;
	if(x%32&&x%27) return 18;
	if(x%19) return 19;
	if(x%64==32&&x%25) return 20;
	if(x%27&&x%49) return 21;
	if(x%23) return 23;
	if(x%32&&x%81) return 24;
	if(x%25) return 25;
	if(x%29) return 29;
	if(x%31) return 31;
	return 0;
}

main(){
	char*rp=mmap(0l,1l<<25,1,2,0,0ll);
	char*wp=wbuf;

	rd_skip();
	while(*rp){
		rd(x);
		long y=f(x);
		long z=x*y;
		wt(z);
		*wp++='\n';
	}

	write(1,wbuf,wp-wbuf);
	_exit(0);
}
0