結果

問題 No.557 点対称
ユーザー butsurizukibutsurizuki
提出日時 2017-06-29 17:15:13
言語 C90
(gcc 11.4.0)
結果
AC  
実行時間 1 ms / 2,000 ms
コード長 600 bytes
コンパイル時間 119 ms
コンパイル使用メモリ 21,632 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-04-15 04:54:51
合計ジャッジ時間 1,032 ms
ジャッジサーバーID
(参考情報)
judge5 / judge4
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 0 ms
6,812 KB
testcase_01 AC 0 ms
6,940 KB
testcase_02 AC 1 ms
6,940 KB
testcase_03 AC 1 ms
6,944 KB
testcase_04 AC 0 ms
6,944 KB
testcase_05 AC 0 ms
6,944 KB
testcase_06 AC 0 ms
6,940 KB
testcase_07 AC 1 ms
6,940 KB
testcase_08 AC 0 ms
6,944 KB
testcase_09 AC 1 ms
6,944 KB
testcase_10 AC 1 ms
6,940 KB
testcase_11 AC 0 ms
6,940 KB
testcase_12 AC 1 ms
6,944 KB
testcase_13 AC 1 ms
6,940 KB
testcase_14 AC 0 ms
6,944 KB
testcase_15 AC 0 ms
6,940 KB
testcase_16 AC 1 ms
6,940 KB
testcase_17 AC 0 ms
6,940 KB
testcase_18 AC 0 ms
6,940 KB
testcase_19 AC 0 ms
6,944 KB
testcase_20 AC 0 ms
6,944 KB
testcase_21 AC 0 ms
6,944 KB
testcase_22 AC 0 ms
6,944 KB
testcase_23 AC 0 ms
6,940 KB
testcase_24 AC 0 ms
6,944 KB
testcase_25 AC 0 ms
6,940 KB
testcase_26 AC 0 ms
6,940 KB
testcase_27 AC 0 ms
6,944 KB
testcase_28 AC 1 ms
6,944 KB
testcase_29 AC 1 ms
6,940 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.c: In function ‘main’:
main.c:24:9: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   24 |         scanf("%lld",&n);
      |         ^~~~~~~~~~~~~~~~

ソースコード

diff #

#include <stdio.h>
#define mod 1000000007

long long rz5(long long a){
	long long i,d[64]={0},x=1152921504606846976,res=1;
	d[0] = 5;
	for(i = 1;i <= 60;i++){
		d[i] = d[i-1] * d[i-1];
		d[i]%=mod;
	}
	for(i = 60;i >= 0;i--){
		if(a >= x){
			res*=d[i];
			res%=mod;
			a-=x;
		}
		x/=2;
	}
	return res;
}

int main(void) {
	long long n;
	scanf("%lld",&n);
	if(n == 1){printf("2\n");return 0;}
	if(n == 2){printf("4\n");return 0;}
	if(n == 3){printf("12\n");return 0;}
	if(n%2 == 0){
		n/=2;
		printf("%lld\n",(4*rz5(n-1))%mod);
	}
	else{
		n/=2;
		printf("%lld\n",(12*rz5(n-1))%mod);
	}
	return 0;
}
0