QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#135421 | #5661. Multi-Ladders | Nicolas125841 | WA | 1ms | 3592kb | C++17 | 881b | 2023-08-05 15:06:14 | 2023-08-05 15:06:15 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
#define rep(i, a, b) for(int i = a; i < (b); ++i)
#define all(x) begin(x), end(x)
#define sz(x) (int)(x).size()
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
const ll mod = 1000000007;
ll modpow(ll b, ll e) {
ll ans = 1;
for (; e; b = b * b % mod, e /= 2)
if (e & 1) ans = ans * b % mod;
return ans;
}
int main(){
cin.tie(NULL)->sync_with_stdio(false);
int t;
cin >> t;
while(t--){
ll n, k, l;
cin >> n >> k >> l;
ll spurs = modpow(modpow(((l - 1) + modpow(l - 2, 2)) % mod, k), n-1);
ll ring = l * modpow(l - 1, k - 1) % mod - l * modpow(l - 1, k - 2) % mod;
ring %= mod;
if(ring < 0)
ring += mod;
cout << ring * spurs % mod << "\n";
}
}
詳細信息
Test #1:
score: 100
Accepted
time: 1ms
memory: 3592kb
input:
1 2 3 3
output:
162
result:
ok single line: '162'
Test #2:
score: -100
Wrong Answer
time: 1ms
memory: 3464kb
input:
20 2 3 3 1 3 3 10 3 0 10 3 2 1 21 2 1 22 0 2000 15000 2000 12000 30000 200000 1000000000 3 3 2 1000000000 3 2 3 100000000 1000000000 1000000000 10 1000000000 3 100000000 2 1000000000 100000000 1 1000000000 10 1 1000000000 100000000 1 1000 100000000 1000000000 1000000000 0 1000000000 1000000000 1 100...
output:
162 6 0 0 0 0 388318872 891305474 52489881 186358669 176686901 502286001 558243892 873610512 67213250 423049 869536635 0 0 145046875
result:
wrong answer 7th lines differ - expected: '349400141', found: '388318872'