結果
問題 | No.557 点対称 |
ユーザー |
|
提出日時 | 2017-08-11 23:20:06 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
AC
|
実行時間 | 2 ms / 2,000 ms |
コード長 | 547 bytes |
コンパイル時間 | 765 ms |
コンパイル使用メモリ | 64,196 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-10-12 21:55:12 |
合計ジャッジ時間 | 1,620 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 30 |
ソースコード
#include <iostream> #include <cstdio> #include <map> #include <cmath> #include <string> #define INF 200000000 #define M 1000000007 #define N 5001 using namespace std; typedef long long int lli; lli p(lli,lli); int main(void){ lli n; cin>>n; if(n==1){ cout<<2<<endl; return 0; } if(n&1) cout<<(12*p(5,(n-2)/2))%M<<endl; else cout<<(4*p(5,(n-1)/2))%M<<endl; return 0; } lli p(lli x,lli y){ lli A=x; if(y==0) return 1; if(y==1) return x; if(y&1){ A=p(x,y/2); return (((A*A)%M)*x)%M; }else{ A=p(x,y/2); return (A*A)%M; } }