結果
| 問題 | No.1287 えぬけー |
| コンテスト | |
| ユーザー |
沙耶花
|
| 提出日時 | 2020-11-13 22:14:51 |
| 言語 | C++17 (gcc 15.2.0 + boost 1.89.0) |
| 結果 |
AC
|
| 実行時間 | 155 ms / 2,000 ms |
| コード長 | 597 bytes |
| 記録 | |
| コンパイル時間 | 2,165 ms |
| コンパイル使用メモリ | 215,664 KB |
| 実行使用メモリ | 6,400 KB |
| 最終ジャッジ日時 | 2026-06-15 03:05:35 |
| 合計ジャッジ時間 | 2,854 ms |
|
ジャッジサーバーID (参考情報) |
judge3_1 / judge2_1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 5 |
ソースコード
#include <stdio.h>
#include <bits/stdc++.h>
#include <atcoder/math>
using namespace atcoder;
using namespace std;
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define Inf 1000000005
#define modulo 1000000007
int main(){
int T;
cin>>T;
rep(_,T){
int X,K;
cin>>X>>K;
vector<long long> num(30);
num[0] = X;
for(int i=1;i<30;i++){
num[i] = num[i-1];
num[i] *= num[i-1];
num[i] %= modulo;
}
long long x = inv_mod(K,modulo-1);
long long ans = 1;
rep(i,30){
if((x>>i)&1)ans *= num[i];
ans %= modulo;
}
cout<<ans<<endl;
}
return 0;
}
沙耶花