結果

問題 No.1409 Simple Math in yukicoder
ユーザー publflpublfl
提出日時 2021-02-26 22:37:11
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 676 bytes
コンパイル時間 485 ms
コンパイル使用メモリ 55,536 KB
実行使用メモリ 6,820 KB
最終ジャッジ日時 2024-10-02 15:18:55
合計ジャッジ時間 11,483 ms
ジャッジサーバーID
(参考情報)
judge5 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other WA * 58
権限があれば一括ダウンロードができます

ソースコード

diff #

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

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;i++) ans.push_back(power(2,a*i,p));
		
		std::sort(ans.begin(),ans.end());
		for(int i=0;i<ans.size();i++) printf("%d ",ans[i]);
		printf("\n");
	}
}
0