結果

問題 No.557 点対称
ユーザー ryoissy
提出日時 2017-08-11 22:44:26
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 450 bytes
コンパイル時間 1,326 ms
コンパイル使用メモリ 157,420 KB
実行使用メモリ 5,248 KB
最終ジャッジ日時 2024-10-12 21:28:43
合計ジャッジ時間 2,230 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 30
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:19:14: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   19 |         scanf("%lld",&n);
      |         ~~~~~^~~~~~~~~~~

ソースコード

diff #

#include <bits/stdc++.h>
#define MOD 1000000007LL
using namespace std;
typedef long long ll;
typedef pair<int,int> P;

ll mod_pow(ll x,ll n){
	ll res=1;
	while(n>0){
		if(n&1)res=res*x%MOD;
		x=x*x%MOD;
		n>>=1;
	}
	return res;
}

int main(void){
	ll n;
	scanf("%lld",&n);
	ll res=1;
	if(n%2==1){
		if(n==1)res=res*2LL%MOD;
		else res=res*3LL%MOD;
	}
	res=res*mod_pow(5,n/2-1)%MOD;
	if(n>=2){
		res=res*4LL%MOD;
	}
	printf("%lld\n",res);
	return 0;
}
0