結果

問題 No.1611 Minimum Multiple with Double Divisors
コンテスト
ユーザー 👑 tails
提出日時 2021-08-13 11:13:51
言語 C(gnu17)
(gcc 15.2.0)
コンパイル:
gcc-15 -O2 -std=gnu17 -Wno-error=implicit-function-declaration -Wno-error=implicit-int -Wno-error=incompatible-pointer-types -Wno-error=int-conversion -DONLINE_JUDGE -o a.out _filename_ -lm
実行:
./a.out
結果
AC  
実行時間 5 ms / 2,000 ms
+ 411µs
コード長 1,193 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 100 ms
コンパイル使用メモリ 40,092 KB
実行使用メモリ 5,888 KB
最終ジャッジ日時 2026-07-23 01:20:46
合計ジャッジ時間 3,630 ms
ジャッジサーバーID
(参考情報)
judge2_0 / judge1_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 37
権限があれば一括ダウンロードができます
コンパイルメッセージ
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' [-Wimplicit-function-declaration]
   54 |         _exit(0);
      |         ^~~~~
main.c:54:9: warning: incompatible implicit declaration of built-in function '_exit' [-Wbuiltin-declaration-mismatch]

ソースコード

diff #
raw source code

#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