QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#174053 | #6637. Perfect Strings | PERAPRO# | WA | 97ms | 3716kb | C++14 | 942b | 2023-09-10 03:56:15 | 2023-09-10 03:56:16 |
Judging History
answer
#include <bits/stdc++.h>
#include <ios>
#define ll long long int
#define ii pair<int, int>
#define ff first
#define ss second
#define vi vector<ll>
#define lli long long
#define vii vector<ii>
#define pb push_back
#define fast_io \
ios_base::sync_with_stdio(0); \
cin.tie(0); \
cout.tie(0);
using namespace std;
const int N = 2e5;
const ll MOD = 1e9 + 7;
ll fpow(ll base, ll e) {
ll ans = 1;
while (e) {
if (e & 1) {
ans = (ans * base) % MOD;
}
base = (base * base) % MOD;
e >>= 1;
}
return ans;
}
int main() {
int tc;
cin >> tc;
while (tc--) {
ll n, c;
cin >> n >> c;
ll res = (2 * fpow(c,n));
res = (res - c + MOD) % MOD;
cout<<res<<endl;
}
return 0;
}
詳細信息
Test #1:
score: 100
Accepted
time: 1ms
memory: 3636kb
input:
2 3 1 2 2
output:
1 6
result:
ok 2 number(s): "1 6"
Test #2:
score: -100
Wrong Answer
time: 97ms
memory: 3716kb
input:
100000 1 1 4 1 5 5 3 5 1 2 5 3 1 1 3 3 5 2 2 1 4 1 5 5 2 3 4 1 3 3 2 5 3 2 4 3 4 4 3 5 3 1 5 2 2 2 4 2 5 4 1 2 3 1 4 5 2 5 5 3 1 5 5 2 3 2 5 2 4 1 1 3 3 2 4 5 2 1 4 1 2 2 1 1 3 5 4 5 2 3 3 5 2 5 2 4 5 4 2 3 1 1 2 1 4 4 1 5 5 4 1 3 5 4 4 5 1 3 1 1 3 3 2 4 2 4 2 1 5 5 1 3 2 3 4 1 4 3 2 4 2 4 4 2 1 1 1...
output:
1 1 6245 245 2 483 1 51 62 1 1 6245 15 1 51 45 14 159 508 245 1 62 6 30 2044 2 1 1245 45 483 5 62 14 62 1 3 14 1245 1 1 6 1 245 1245 15 245 45 28 2044 15 1 1 508 5 2044 3 2044 1245 3 1 51 28 28 1 6245 3 15 1 159 28 28 30 1 1 6245 15 508 3 1 2 15 51 508 2044 6245 6 62 508 62 15 5 2 1 30 1 1 6 2044 48...
result:
wrong answer 3rd numbers differ - expected: '71445', found: '6245'