結果

問題 No.1409 Simple Math in yukicoder
ユーザー publflpublfl
提出日時 2021-02-26 22:25:50
言語 C++14
(gcc 13.2.0 + boost 1.83.0)
結果
TLE  
実行時間 -
コード長 839 bytes
コンパイル時間 461 ms
コンパイル使用メモリ 50,048 KB
実行使用メモリ 10,752 KB
最終ジャッジ日時 2024-04-10 13:10:16
合計ジャッジ時間 63,101 ms
ジャッジサーバーID
(参考情報)
judge1 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
10,752 KB
testcase_01 AC 2 ms
5,376 KB
testcase_02 AC 2 ms
5,376 KB
testcase_03 AC 2 ms
5,376 KB
testcase_04 AC 2 ms
5,376 KB
testcase_05 AC 2 ms
5,376 KB
testcase_06 AC 2 ms
5,376 KB
testcase_07 AC 565 ms
5,376 KB
testcase_08 AC 1,932 ms
5,376 KB
testcase_09 AC 494 ms
5,376 KB
testcase_10 AC 1,530 ms
5,376 KB
testcase_11 AC 1,900 ms
5,376 KB
testcase_12 AC 1,465 ms
5,376 KB
testcase_13 AC 567 ms
5,376 KB
testcase_14 AC 439 ms
5,376 KB
testcase_15 AC 678 ms
5,376 KB
testcase_16 AC 718 ms
5,376 KB
testcase_17 TLE -
testcase_18 AC 1,264 ms
5,376 KB
testcase_19 AC 1,353 ms
5,376 KB
testcase_20 AC 1,086 ms
5,376 KB
testcase_21 AC 863 ms
5,376 KB
testcase_22 AC 1,634 ms
5,376 KB
testcase_23 AC 341 ms
5,376 KB
testcase_24 AC 265 ms
5,376 KB
testcase_25 AC 1,575 ms
5,376 KB
testcase_26 AC 1,718 ms
5,376 KB
testcase_27 TLE -
testcase_28 TLE -
testcase_29 TLE -
testcase_30 TLE -
testcase_31 TLE -
testcase_32 TLE -
testcase_33 TLE -
testcase_34 TLE -
testcase_35 TLE -
testcase_36 TLE -
testcase_37 TLE -
testcase_38 -- -
testcase_39 -- -
testcase_40 -- -
testcase_41 -- -
testcase_42 -- -
testcase_43 -- -
testcase_44 -- -
testcase_45 -- -
testcase_46 -- -
testcase_47 -- -
testcase_48 -- -
testcase_49 -- -
testcase_50 -- -
testcase_51 -- -
testcase_52 -- -
testcase_53 -- -
testcase_54 -- -
testcase_55 -- -
testcase_56 -- -
testcase_57 -- -
testcase_58 -- -
testcase_59 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <stdio.h>
#include <vector>

long long int power(long long int a, long long int b, int p)
{
	long long int ans = 1;
	long long int k = a;
	while(b)
	{
		if(b%2==1) ans*=k, ans%=p;
		k*=k, k%=p;
		b/=2;
	}
	return ans;
}
long long int inv(long long int a, int p)
{
	return power(a,p-2,p);
}

long long int fact[110];
std::vector<int> ans;

int main()
{
	fact[0] = 1;
	int T;
	scanf("%d",&T);
	while(T--)
	{
		ans.clear();
		int a,b;
		scanf("%d%d",&a,&b);
		int p = a*b+1;
		for(int i=1;i<=b-1;i++) fact[i] = (fact[i-1]*i)%p;
		//long long int C = inv(fact[b-1],p);
		//if(b%2==1) C = (p-C)%p;
		//printf("%lld!!\n",C);
		
		for(int i=1;i<=a*b;i++)
		{
			long long int t = power(i,b,p);
			//printf("%d %lld??\n",i,t);
			if(t==1) ans.push_back(i);
		}
		
		for(int i=0;i<ans.size();i++) printf("%d ",ans[i]);
		printf("\n");
	}
}
0