結果

問題 No.1529 Constant Lcm
ユーザー tailstails
提出日時 2021-06-04 22:24:03
言語 C
(gcc 12.3.0)
結果
WA  
実行時間 -
コード長 928 bytes
コンパイル時間 1,429 ms
コンパイル使用メモリ 30,720 KB
実行使用メモリ 6,948 KB
最終ジャッジ日時 2024-04-30 06:37:17
合計ジャッジ時間 1,614 ms
ジャッジサーバーID
(参考情報)
judge3 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 5 ms
6,816 KB
testcase_01 AC 4 ms
6,944 KB
testcase_02 AC 5 ms
6,940 KB
testcase_03 AC 4 ms
6,944 KB
testcase_04 AC 4 ms
6,940 KB
testcase_05 AC 4 ms
6,940 KB
testcase_06 WA -
testcase_07 AC 5 ms
6,940 KB
testcase_08 AC 5 ms
6,948 KB
testcase_09 AC 4 ms
6,940 KB
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 AC 6 ms
6,944 KB
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
testcase_20 WA -
testcase_21 WA -
testcase_22 WA -
testcase_23 AC 6 ms
6,944 KB
testcase_24 WA -
testcase_25 WA -
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.c:23:1: warning: return type defaults to 'int' [-Wimplicit-int]
   23 | main(){
      | ^~~~
main.c: In function 'main':
main.c:27:9: warning: implicit declaration of function 'read'; did you mean 'rd'? [-Wimplicit-function-declaration]
   27 |         read(0,rbuf,sizeof rbuf);
      |         ^~~~
      |         rd
main.c:57:9: warning: implicit declaration of function 'write' [-Wimplicit-function-declaration]
   57 |         write(1,wp,wbuf+sizeof wbuf-wp);
      |         ^~~~~
main.c:58:9: warning: implicit declaration of function '_exit'; did you mean '_Exit'? [-Wimplicit-function-declaration]
   58 |         _exit(0);
      |         ^~~~~
      |         _Exit

ソースコード

diff #

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

#define rd(v) long v=0;{int _c;while(_c=*rp++-48,_c>=0)v=v*10+_c;}

#define wt(v) {long _z=v;do*--wp=_z%10+48;while(_z/=10);}


#define SIEVE_N 1000001
char sieve[SIEVE_N];
void mksieve(){
	for(long i=2;i<SIEVE_N;++i){
		if(sieve[i]==0){
			for(long j=i*i;j<SIEVE_N;j+=i){
				sieve[j]=1;
			}
		}
	}
}

#define MD 998244353

main(){
	mksieve();
	
	char rbuf[64];
	read(0,rbuf,sizeof rbuf);
	char*rp=rbuf;
	rd(n);
	
	long res=1;

	for(long p=2;p<n;++p){
		if(!sieve[p]){
			if(n%p==0){
				long maxc=0;
				long j=1;
				long c0=0;
				while(j<n){
					long c=c0++;
					long jj=1;
					long nn=n-j;
					while(jj*=p,jj<=nn) ++c;
					maxc=maxc>=c?maxc:c;
					j*=p;
				}
				while(maxc--) res=res*p%MD;
			}else{
				long j=1;
				while(j*=p,j<n) res=res*p%MD;
			}
		}
	}

	char wbuf[64],*wp=wbuf+sizeof wbuf;
	wt(res);
	write(1,wp,wbuf+sizeof wbuf-wp);
	_exit(0);
}
0