結果
問題 | No.557 点対称 |
ユーザー |
|
提出日時 | 2017-06-29 17:15:13 |
言語 | C90 (gcc 12.3.0) |
結果 |
AC
|
実行時間 | 1 ms / 2,000 ms |
コード長 | 600 bytes |
コンパイル時間 | 321 ms |
コンパイル使用メモリ | 21,504 KB |
実行使用メモリ | 6,820 KB |
最終ジャッジ日時 | 2024-10-04 16:45:25 |
合計ジャッジ時間 | 1,398 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 30 |
コンパイルメッセージ
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); | ^~~~~~~~~~~~~~~~
ソースコード
#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; }