結果
| 問題 | No.1136 Four Points Tour |
| ユーザー |
Sooh31
|
| 提出日時 | 2020-08-19 16:21:11 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.89.0) |
| 結果 |
AC
|
| 実行時間 | 105 ms / 2,000 ms |
| コード長 | 586 bytes |
| 記録 | |
| コンパイル時間 | 1,978 ms |
| コンパイル使用メモリ | 191,312 KB |
| 最終ジャッジ日時 | 2025-01-13 03:50:55 |
|
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 22 RE * 19 |
ソースコード
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i = 0; i < n; i++)
using ll = long long;
using graph = vector<vector<int>>;
const ll mod = 1000000007;
const int INF = 1001001001;
ll modpow(ll a, ll p){
ll ret = 1;
while(p){
if(p&1) ret = ret * a % mod;
a = a * a % mod;
p >>= 1;
}
return ret;
}
ll dp[1000007];
int main() {
dp[0] = 1;
ll n; cin >> n;
//i秒後にAにいる場合の数
for(int i = 0; i <= n; i++){
dp[i+1] = (mod + modpow(3, i) - dp[i]) % mod;
}
cout << dp[n] << endl;
}
Sooh31