Task: | Exponentiation |
Sender: | htoik |
Submission time: | 2024-11-18 10:35:09 +0200 |
Language: | C++ (C++20) |
Status: | READY |
Result: | WRONG ANSWER |
test | verdict | time | |
---|---|---|---|
#1 | WRONG ANSWER | 0.01 s | details |
#2 | WRONG ANSWER | 0.04 s | details |
#3 | WRONG ANSWER | 0.04 s | details |
Compiler report
input/code.cpp: In function 'int main()': input/code.cpp:25:20: warning: right operand of comma operator has no effect [-Wunused-value] 25 | cin >> a, b; | ^ input/code.cpp:8:25: warning: 'b' may be used uninitialized [-Wmaybe-uninitialized] 8 | long long u = modpow(x,n/2,m); | ~~~~~~^~~~~~~~~ input/code.cpp:24:16: note: 'b' was declared here 24 | int a, b; | ^
Code
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef unsigned long long ull; int modpow(int x, int n, int m) { if (n == 0) return 1%m; long long u = modpow(x,n/2,m); u = (u*u)%m; if (n%2 == 1) u = (u*x)%m; return u; } int main() { ios::sync_with_stdio(0); cin.tie(0); constexpr const int MOD = 1000000007; ull n; cin >> n; for(ull i=0; i<n; i++){ int a, b; cin >> a, b; cout << modpow(a, b, MOD); } }
Test details
Test 1
Verdict: WRONG ANSWER
input |
---|
10201 0 0 0 1 0 2 0 3 ... |
correct output |
---|
1 0 0 0 0 ... |
user output |
---|
111111111111111111111111111111... Truncated |
Test 2
Verdict: WRONG ANSWER
input |
---|
200000 129612095 411099530 241615980 487174929 60862511 511830781 758816482 982657640 ... |
correct output |
---|
276067146 838400234 148093882 546897305 467086232 ... |
user output |
---|
111111111111111111111111111111... Truncated |
Test 3
Verdict: WRONG ANSWER
input |
---|
200000 692427692 536870911 252480658 536870911 505090334 536870911 27194853 536870911 ... |
correct output |
---|
940305728 707431813 917260341 908974199 375947818 ... |
user output |
---|
111111111111111111111111111111... Truncated |