結果

問題 No.1396 Giri
ユーザー publflpublfl
提出日時 2021-02-14 21:36:12
言語 C++14
(gcc 13.2.0 + boost 1.83.0)
結果
AC  
実行時間 13 ms / 2,000 ms
コード長 766 bytes
コンパイル時間 328 ms
コンパイル使用メモリ 48,640 KB
実行使用メモリ 7,028 KB
最終ジャッジ日時 2023-09-29 14:49:08
合計ジャッジ時間 1,742 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 13 ms
6,968 KB
testcase_01 AC 13 ms
7,000 KB
testcase_02 AC 13 ms
6,996 KB
testcase_03 AC 12 ms
6,892 KB
testcase_04 AC 13 ms
6,968 KB
testcase_05 AC 13 ms
6,968 KB
testcase_06 AC 13 ms
6,952 KB
testcase_07 AC 12 ms
6,984 KB
testcase_08 AC 12 ms
6,952 KB
testcase_09 AC 13 ms
6,964 KB
testcase_10 AC 13 ms
6,968 KB
testcase_11 AC 13 ms
7,028 KB
testcase_12 AC 12 ms
7,004 KB
testcase_13 AC 12 ms
6,988 KB
testcase_14 AC 12 ms
6,972 KB
testcase_15 AC 13 ms
7,000 KB
testcase_16 AC 13 ms
6,968 KB
testcase_17 AC 12 ms
6,960 KB
testcase_18 AC 12 ms
6,964 KB
testcase_19 AC 13 ms
6,964 KB
testcase_20 AC 12 ms
6,960 KB
testcase_21 AC 12 ms
6,944 KB
testcase_22 AC 12 ms
6,968 KB
testcase_23 AC 13 ms
6,988 KB
testcase_24 AC 13 ms
6,964 KB
testcase_25 AC 13 ms
6,960 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <stdio.h>
#include <vector>
#define MOD 998244353
std::vector<int> prime;
int check[1000010];
long long int gcd(long long int a, long long int b)
{
	return a?gcd(b%a,a):b;
}
long long int lcm(long long int a, long long int b)
{
	return (a/gcd(a,b))*b;
}

int main()
{
	for(int i=2;i<=1000000;i++)
	{
		if(check[i]==0)
		{
			prime.push_back(i);
			for(int j=i;j<=1000000;j+=i) check[j] = 1;
		}
	}
	int a;
	scanf("%d",&a);
	
	int t = 0;
	for(int i=prime.size()-1;i>=0;i--)
	{
		if(prime[i]<=a)
		{
			t = prime[i];
			break;
		}
	}
	
	long long int ans = 1;
	for(int i=0;i<prime.size();i++)
	{
		if(prime[i]==t) break;
		long long int C = 1;
		while(1)
		{
			C*=prime[i];
			if(C>a) break;
			ans *= prime[i];
			ans %= MOD;
		}
	}
	printf("%lld\n",ans);
}
0