結果
| 問題 | No.72 そろばん Med | 
| コンテスト | |
| ユーザー |  spacia | 
| 提出日時 | 2016-01-24 08:57:51 | 
| 言語 | Java (openjdk 23) | 
| 結果 | 
                                AC
                                 
                             | 
| 実行時間 | 63 ms / 5,000 ms | 
| コード長 | 928 bytes | 
| コンパイル時間 | 2,514 ms | 
| コンパイル使用メモリ | 75,664 KB | 
| 実行使用メモリ | 37,520 KB | 
| 最終ジャッジ日時 | 2024-11-21 11:52:07 | 
| 合計ジャッジ時間 | 4,694 ms | 
| ジャッジサーバーID (参考情報) | judge2 / judge3 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 3 | 
| other | AC * 24 | 
ソースコード
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);
	}
}
            
            
            
        