結果

問題 No.673 カブトムシ
ユーザー 夕叢霧香(ゆうむらきりか)
提出日時 2018-04-13 22:30:49
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 612 bytes
コンパイル時間 601 ms
コンパイル使用メモリ 72,980 KB
最終ジャッジ日時 2025-01-05 10:03:12
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 12 WA * 2
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<algorithm>
#include<iostream>
#include<vector>
using namespace std;
typedef long long lint;
typedef vector<int>vi;
typedef pair<int,int>pii;
#define rep(i,n)for(int i=0;i<(int)(n);++i)

const lint mod=1e9+7;

lint powmod(lint x,lint e){
  lint prod=1%mod;
  for(int i=63;i>=0;--i){
    prod=prod*prod%mod;
    if(e&1LL<<i)prod=prod*x%mod;
  }
  return prod;
}


int main(){
  lint b,c,d;
  cin>>b>>c>>d;
  b%=mod;
  c%=mod;
  lint x=b*c%mod;
  x=x*powmod((c-1+mod)%mod,mod-2)%mod;
  lint y=(mod-x)%mod;
  lint u=powmod(c,d);
  u=u*x%mod;
  u=(u+y)%mod;
  if(c==1){
    u=d*b%mod;
  }
  cout<<u<<endl;
}
0