結果

問題 No.72 そろばん Med
ユーザー tsunabittsunabit
提出日時 2020-01-03 20:29:58
言語 Java21
(openjdk 21)
結果
AC  
実行時間 123 ms / 5,000 ms
コード長 644 bytes
コンパイル時間 3,057 ms
コンパイル使用メモリ 72,168 KB
実行使用メモリ 56,744 KB
最終ジャッジ日時 2023-08-14 19:25:05
合計ジャッジ時間 7,425 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 116 ms
56,240 KB
testcase_01 AC 113 ms
55,820 KB
testcase_02 AC 115 ms
56,360 KB
testcase_03 AC 118 ms
55,848 KB
testcase_04 AC 119 ms
55,720 KB
testcase_05 AC 115 ms
56,744 KB
testcase_06 AC 113 ms
56,400 KB
testcase_07 AC 115 ms
56,004 KB
testcase_08 AC 116 ms
56,148 KB
testcase_09 AC 115 ms
56,104 KB
testcase_10 AC 116 ms
55,588 KB
testcase_11 AC 119 ms
54,284 KB
testcase_12 AC 115 ms
54,012 KB
testcase_13 AC 117 ms
56,296 KB
testcase_14 AC 120 ms
56,048 KB
testcase_15 AC 116 ms
56,208 KB
testcase_16 AC 118 ms
55,828 KB
testcase_17 AC 122 ms
55,976 KB
testcase_18 AC 116 ms
56,204 KB
testcase_19 AC 117 ms
55,660 KB
testcase_20 AC 120 ms
56,056 KB
testcase_21 AC 118 ms
55,484 KB
testcase_22 AC 119 ms
55,952 KB
testcase_23 AC 123 ms
55,796 KB
testcase_24 AC 118 ms
56,012 KB
testcase_25 AC 117 ms
55,848 KB
testcase_26 AC 117 ms
56,552 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