結果

問題 No.72 そろばん Med
ユーザー spaciaspacia
提出日時 2016-01-24 08:57:51
言語 Java21
(openjdk 21)
結果
AC  
実行時間 65 ms / 5,000 ms
コード長 928 bytes
コンパイル時間 2,268 ms
コンパイル使用メモリ 76,124 KB
実行使用メモリ 37,628 KB
最終ジャッジ日時 2024-05-01 08:42:36
合計ジャッジ時間 4,861 ms
ジャッジサーバーID
(参考情報)
judge2 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 60 ms
37,524 KB
testcase_01 AC 60 ms
37,524 KB
testcase_02 AC 63 ms
37,332 KB
testcase_03 AC 60 ms
37,532 KB
testcase_04 AC 60 ms
37,444 KB
testcase_05 AC 59 ms
37,516 KB
testcase_06 AC 60 ms
37,152 KB
testcase_07 AC 60 ms
37,384 KB
testcase_08 AC 61 ms
37,472 KB
testcase_09 AC 60 ms
37,492 KB
testcase_10 AC 61 ms
37,572 KB
testcase_11 AC 59 ms
37,040 KB
testcase_12 AC 60 ms
37,032 KB
testcase_13 AC 65 ms
37,612 KB
testcase_14 AC 62 ms
37,396 KB
testcase_15 AC 60 ms
37,628 KB
testcase_16 AC 61 ms
37,484 KB
testcase_17 AC 59 ms
37,524 KB
testcase_18 AC 62 ms
37,316 KB
testcase_19 AC 60 ms
37,124 KB
testcase_20 AC 60 ms
37,172 KB
testcase_21 AC 63 ms
37,600 KB
testcase_22 AC 62 ms
37,556 KB
testcase_23 AC 59 ms
37,612 KB
testcase_24 AC 60 ms
37,444 KB
testcase_25 AC 65 ms
37,468 KB
testcase_26 AC 61 ms
37,612 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.io.*;
import java.util.*;
import java.math.*;

class Main {
	public static void main (String[] args) throws IOException {
            BufferedReader br = 
                    new BufferedReader(new InputStreamReader(System.in));
            
            BigInteger n = new BigInteger(br.readLine());
            BigInteger zero = BigInteger.ZERO;
            BigInteger one = BigInteger.ONE;
            BigInteger two = BigInteger.valueOf(2);
            BigInteger mod = BigInteger.valueOf(1000007);
            
            if (n.remainder(two).compareTo(zero) == 0) {
                jout(n.divide(two).add(one).pow(2).subtract(one).mod(mod) + "\n");
            } else {
                jout(n.add(one).divide(two).add(one).multiply(n.subtract(one).divide(two).add(one)).subtract(one).mod(mod) + "\n");
            }
	}
        
       	public static void jout (Object o) {
            System.out.print(o);
	}
}
0