結果
| 問題 |
No.1287 えぬけー
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2020-11-13 21:45:10 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 230 ms / 2,000 ms |
| コード長 | 506 bytes |
| コンパイル時間 | 441 ms |
| コンパイル使用メモリ | 66,608 KB |
| 実行使用メモリ | 6,944 KB |
| 最終ジャッジ日時 | 2024-07-22 20:36:54 |
| 合計ジャッジ時間 | 2,022 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 5 |
コンパイルメッセージ
a.cpp:5:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
ソースコード
#line 1 "a.cpp"
#include<iostream>
using namespace std;
#line 1 "/home/kotatsugame/library/math/extgcd.cpp"
template<typename T>
T extgcd(T a,T b,T&x,T&y)
{
if(b==0)
{
x=1;
y=0;
return a;
}
T q=a/b;
T g=extgcd(b,a-q*b,y,x);
y-=q*x;
return g;
}
#line 4 "a.cpp"
int T;
main()
{
cin>>T;
for(;T--;)
{
long X,K;cin>>X>>K;
long x,y;
long m=1e9+6;
extgcd(m,K,x,y);
y%=m;
if(y<m)y+=m;
m++;
long r=1;
while(y)
{
if(y%2)r=r*X%m;
y>>=1;
X=X*X%m;
}
cout<<r<<endl;
}
}