結果

問題 No.72 そろばん Med
ユーザー tsunabittsunabit
提出日時 2020-01-03 20:29:58
言語 Java21
(openjdk 21)
結果
AC  
実行時間 122 ms / 5,000 ms
コード長 644 bytes
コンパイル時間 2,847 ms
コンパイル使用メモリ 74,804 KB
実行使用メモリ 54,160 KB
最終ジャッジ日時 2024-05-02 07:27:31
合計ジャッジ時間 6,700 ms
ジャッジサーバーID
(参考情報)
judge5 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 110 ms
53,408 KB
testcase_01 AC 119 ms
54,084 KB
testcase_02 AC 115 ms
53,988 KB
testcase_03 AC 116 ms
54,160 KB
testcase_04 AC 102 ms
52,868 KB
testcase_05 AC 108 ms
53,716 KB
testcase_06 AC 105 ms
52,908 KB
testcase_07 AC 105 ms
52,896 KB
testcase_08 AC 110 ms
53,908 KB
testcase_09 AC 116 ms
53,900 KB
testcase_10 AC 112 ms
53,708 KB
testcase_11 AC 97 ms
52,604 KB
testcase_12 AC 105 ms
52,728 KB
testcase_13 AC 106 ms
53,100 KB
testcase_14 AC 100 ms
52,596 KB
testcase_15 AC 122 ms
54,000 KB
testcase_16 AC 116 ms
53,896 KB
testcase_17 AC 111 ms
53,976 KB
testcase_18 AC 112 ms
53,912 KB
testcase_19 AC 116 ms
53,824 KB
testcase_20 AC 103 ms
52,876 KB
testcase_21 AC 114 ms
54,060 KB
testcase_22 AC 115 ms
53,732 KB
testcase_23 AC 107 ms
54,124 KB
testcase_24 AC 120 ms
41,544 KB
testcase_25 AC 101 ms
39,332 KB
testcase_26 AC 111 ms
41,056 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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

public class No72 {
//	private static Set<String> set = new HashSet<String>();
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		long n = sc.nextLong();
		long ans = 0;
		long t = 1000007;
		// a個の時、a+1までの数を表現出来て、これが2箇所に分かれるとして、
		// 均等に割った方が良いので、((N+1)/2+1)*(N/2+1)-1ですかね?
		// modを取るのだけ気を付けないとですね
		ans = (((n / 2 + 1) % t) * ((n - (n / 2) + 1) % t) - 1) % t;
		if(ans < 0) {
			ans += t;
		}
		System.out.println(ans);
	}
}
0