結果
| 問題 |
No.1518 Simple Combinatorics
|
| コンテスト | |
| ユーザー |
Nachia
|
| 提出日時 | 2021-05-14 00:11:03 |
| 言語 | C++17(gcc12) (gcc 12.3.0 + boost 1.87.0) |
| 結果 |
CE
(最新)
AC
(最初)
|
| 実行時間 | - |
| コード長 | 749 bytes |
| コンパイル時間 | 67 ms |
| コンパイル使用メモリ | 24,960 KB |
| 最終ジャッジ日時 | 2025-01-21 10:49:29 |
|
ジャッジサーバーID (参考情報) |
judge2 / judge2 |
(要ログイン)
コンパイルエラー時のメッセージ・ソースコードは、提出者また管理者しか表示できないようにしております。(リジャッジ後のコンパイルエラーは公開されます)
ただし、clay言語の場合は開発者のデバッグのため、公開されます。
ただし、clay言語の場合は開発者のデバッグのため、公開されます。
コンパイルメッセージ
main.cpp:6:10: fatal error: testlib.h: No such file or directory
6 | #include "testlib.h"
| ^~~~~~~~~~~
compilation terminated.
ソースコード
//
// Validator 1.0
//
#include "testlib.h"
#include <iostream>
using namespace std;
using ll = long long;
using ull = unsigned long long;
#define rep(i,n) for(int i=0; i<(n); i++)
const ull M = 1'000'000'007;
ull powm(ull a,ull i){
if(i == 0) return 1;
ull r = powm(a*a%M,i/2);
if(i%2 == 1) r = r * a % M;
return r;
}
int main(){
registerValidation();
ull N = inf.readUnsignedLong(1,M-1);
inf.readChar(' ');
ull K = inf.readUnsignedLong(1,M-1);
inf.readEoln();
inf.readEof();
ull ans = powm(N,K) * N % M;
ans = (ans + (M - powm(N-1,K)) * N) % M;
cout << ans << "\n";
return 0;
}
struct ios_do_not_sync{
ios_do_not_sync(){
ios::sync_with_stdio(false);
cin.tie(nullptr);
}
} ios_do_not_sync_instance;
Nachia