QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#218459 | #969. Discrete Logarithm is a Joke | WRuperD | WA | 560ms | 19044kb | C++14 | 983b | 2023-10-18 12:41:40 | 2023-10-18 12:41:41 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
const long long inf = 1e18;
const int mininf = 1e9 + 7;
#define int __int128
#define pb emplace_back
inline int read(){int x=0,f=1;char ch=getchar();while(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();}while(ch>='0'&&ch<='9'){x=(x<<1)+(x<<3)+(ch^48);ch=getchar();}return x*f;}
inline void write(int x){if(x<0){x=~(x-1);putchar('-');}if(x>9)write(x/10);putchar(x%10+'0');}
#define put() putchar(' ')
#define endl puts("")
const int MAX = 1000005;
const int mod = 1e18;
int ans[MAX];
int quickPower(int a,int b,int p)
{int base=a,ans=1;while(b){if(b % 2)ans*=base,ans%=p;base*=base;base%=p;b /= 2;}return ans;
}
void solve(){
int n = 1000000;
int now = 300;
int mod2 = mod + 9;
for(int i = n; i >= 0; i--){
ans[i] = now;
now = quickPower(7, now, mod2);
}
int x = read();
write(ans[x]), endl;
}
signed main(){
int t = 1;
while(t--) solve();
return 0;
}
详细
Test #1:
score: 0
Wrong Answer
time: 560ms
memory: 19044kb
input:
0
output:
887791927227458592
result:
wrong answer 1st numbers differ - expected: '960002411612632915', found: '887791927227458592'