結果
| 問題 |
No.1181 Product Sum for All Subsets
|
| コンテスト | |
| ユーザー |
PCTprobability
|
| 提出日時 | 2020-07-24 11:21:31 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
MLE
|
| 実行時間 | - |
| コード長 | 438 bytes |
| コンパイル時間 | 2,123 ms |
| コンパイル使用メモリ | 171,144 KB |
| 実行使用メモリ | 814,720 KB |
| 最終ジャッジ日時 | 2024-06-24 22:37:19 |
| 合計ジャッジ時間 | 5,010 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | MLE * 1 -- * 2 |
| other | -- * 27 |
ソースコード
#include <bits/stdc++.h>
#include <iostream>
#include <random>
using namespace std;
using ull = long long;
ull modpow(ull x, ull n, ull mod){
ull ret = 1;
while(n){
if(n & 1){
ret = modpow(ret, x, mod);
}
x = modpow(x, x, mod);
n >>= 1;
}
return ret;
}
int main(){
ull a,b;
cin>>b>>a;
ull mod=1000000007;
a=a%mod;
ull s=(a*(a+3)%mod);
ull k=(a*(a+1)%mod);
cout<<modpow(s,b,mod)%mod-modpow(k,b,mod)%mod<<endl;
}
PCTprobability