QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#133206 | #5661. Multi-Ladders | tselmegkh# | WA | 1ms | 3624kb | C++20 | 1.2kb | 2023-08-01 18:34:57 | 2023-08-01 18:34:59 |
Judging History
answer
#include <iostream>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <cstdlib>
#include <cmath>
#include <cstring>
#include <iomanip>
using namespace std;
const int N = 2e5 + 5, inf = 1e9;
#define pb push_back
#define mp make_pair
#define ll long long
#define ff first
#define ss second
#define all(a) a.begin(),a.end()
#define sz(x) (int)x.size()
typedef vector<int> vi;
typedef pair<int,int> ii;
typedef vector<ii> vii;
const ll mod = 1e9 + 7;
ll binpow(ll a, ll b){
ll res = 1;
while(b > 0){
if(b & 1) res = res * a % mod;
a = a * a % mod;
b >>= 1;
}
return res;
}
ll add(ll a, ll b){
a += b;
a %= mod;
return a;
}
ll mul(ll a, ll b){
a *= b;
a %= mod;
return a;
}
void solve(){
ll n, k, y;
cin >> n >> k >> y;
ll res = mul(add(binpow(y - 1, k), mul(binpow(-1, k), (y - 1))), binpow(binpow(y * y - 3 * y + 3, n - 1), k));
cout << res << '\n';
}
int main(){
ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
int t = 1;
cin >> t;
while(t--){
solve();
}
return 0;
}
詳細信息
Test #1:
score: 100
Accepted
time: 1ms
memory: 3624kb
input:
1 2 3 3
output:
162
result:
ok single line: '162'
Test #2:
score: -100
Wrong Answer
time: 1ms
memory: 3376kb
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 349400141 536959608 52489881 53690844 176686901 218103365 374278717 991895211 693053429 883715672 80402569 0 0 122563013
result:
wrong answer 8th lines differ - expected: '243010659', found: '536959608'