結果
| 問題 |
No.557 点対称
|
| コンテスト | |
| ユーザー |
uafr_cs
|
| 提出日時 | 2017-11-01 17:28:25 |
| 言語 | Java (openjdk 23) |
| 結果 |
RE
|
| 実行時間 | - |
| コード長 | 861 bytes |
| コンパイル時間 | 4,746 ms |
| コンパイル使用メモリ | 76,472 KB |
| 実行使用メモリ | 41,500 KB |
| 最終ジャッジ日時 | 2024-11-22 14:35:54 |
| 合計ジャッジ時間 | 9,959 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 19 RE * 11 |
ソースコード
import java.util.Arrays;
import java.util.LinkedList;
import java.util.Scanner;
public class Main {
public static long MOD = 1000000007;
public static long mod_pow(long a, long x){
if(x == 0){ return 1l; }
else if(x == 1){ return a; }
else if(x % 2 == 1){ return (mod_pow(a, x - 1) * a) % MOD; }
else{
final long t = mod_pow(a, x / 2);
return (t * t) % MOD;
}
}
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
final int N = sc.nextInt();
if(N == 1){
System.out.println(2);
}else if(N == 2){
System.out.println(4);
}else if(N % 2 == 1){
final long run = (N - 3) / 2;
final long x = mod_pow(5, run);
System.out.println((3 * x * 4) % MOD);
}else{
final long run = (N - 4) / 2;
final long x = mod_pow(5, run);
System.out.println((5 * x * 4) % MOD);
}
}
}
uafr_cs