結果

問題 No.741 AscNumber(Easy)
ユーザー 37zigen37zigen
提出日時 2018-10-05 23:02:48
言語 Java21
(openjdk 21)
結果
AC  
実行時間 128 ms / 2,000 ms
コード長 1,894 bytes
コンパイル時間 2,015 ms
コンパイル使用メモリ 78,768 KB
実行使用メモリ 41,768 KB
最終ジャッジ日時 2024-04-20 17:26:45
合計ジャッジ時間 9,804 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 116 ms
40,136 KB
testcase_01 AC 120 ms
41,176 KB
testcase_02 AC 106 ms
41,212 KB
testcase_03 AC 116 ms
41,732 KB
testcase_04 AC 120 ms
41,120 KB
testcase_05 AC 119 ms
41,652 KB
testcase_06 AC 122 ms
41,104 KB
testcase_07 AC 110 ms
41,352 KB
testcase_08 AC 110 ms
41,304 KB
testcase_09 AC 109 ms
41,560 KB
testcase_10 AC 119 ms
40,208 KB
testcase_11 AC 108 ms
41,512 KB
testcase_12 AC 123 ms
41,384 KB
testcase_13 AC 123 ms
41,396 KB
testcase_14 AC 111 ms
41,216 KB
testcase_15 AC 123 ms
41,764 KB
testcase_16 AC 110 ms
41,496 KB
testcase_17 AC 121 ms
41,268 KB
testcase_18 AC 120 ms
41,380 KB
testcase_19 AC 123 ms
41,376 KB
testcase_20 AC 128 ms
41,132 KB
testcase_21 AC 122 ms
41,396 KB
testcase_22 AC 126 ms
40,960 KB
testcase_23 AC 123 ms
41,680 KB
testcase_24 AC 119 ms
40,080 KB
testcase_25 AC 120 ms
40,116 KB
testcase_26 AC 110 ms
41,320 KB
testcase_27 AC 120 ms
40,208 KB
testcase_28 AC 123 ms
41,552 KB
testcase_29 AC 121 ms
41,388 KB
testcase_30 AC 120 ms
41,340 KB
testcase_31 AC 108 ms
41,184 KB
testcase_32 AC 108 ms
41,528 KB
testcase_33 AC 104 ms
41,100 KB
testcase_34 AC 119 ms
41,536 KB
testcase_35 AC 118 ms
41,260 KB
testcase_36 AC 118 ms
40,124 KB
testcase_37 AC 106 ms
40,240 KB
testcase_38 AC 113 ms
39,952 KB
testcase_39 AC 109 ms
41,228 KB
testcase_40 AC 107 ms
41,204 KB
testcase_41 AC 120 ms
41,272 KB
testcase_42 AC 121 ms
40,112 KB
testcase_43 AC 123 ms
41,300 KB
testcase_44 AC 121 ms
41,364 KB
testcase_45 AC 124 ms
41,336 KB
testcase_46 AC 123 ms
41,204 KB
testcase_47 AC 121 ms
40,052 KB
testcase_48 AC 119 ms
41,120 KB
testcase_49 AC 121 ms
41,268 KB
testcase_50 AC 121 ms
41,520 KB
testcase_51 AC 111 ms
41,768 KB
testcase_52 AC 118 ms
41,252 KB
testcase_53 AC 105 ms
41,252 KB
testcase_54 AC 120 ms
41,588 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.io.FileNotFoundException;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Scanner;

class Main {

	class BIT {
		int n;
		long[] v;

		public BIT(int n_) {
			n = n_;
			v = new long[n + 1];
		}

		void add(int k, int val) {
			while (k <= n) {
				v[k] += val;
				k += k & -k;
			}
		}

		long sum(int k) {
			long ret = 0;
			while (k >= 1) {
				ret += v[k];
				k -= k & -k;
			}
			return ret;
		}

		long sum(int l, int r) {
			return sum(r - 1) - sum(l - 1);
		}
	}

	final long MOD = (long) 1e9 + 7;

	void run() {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		PrintWriter pw = new PrintWriter(System.out);
		long ans = 1;
		// (N+9)!/N!/9!
		for (int i = N + 1; i <= N + 9; ++i)
			ans = ans * i % MOD;
		for (int i = 1; i <= 9; ++i)
			ans = ans * inv(i) % MOD;
		pw.println(ans);
		pw.close();
	}

	long inv(long a) {
		return pow(a, MOD - 2);
	}

	long pow(long a, long n) {
		long ret = 1;
		for (; n > 0; n >>= 1, a = a * a % MOD) {
			if (n % 2 == 1)
				ret = ret * a % MOD;
		}
		return ret;
	}

	class SegmentTree {
		int n;
		int[] sum;

		public SegmentTree(int n_) {
			n = 1;
			while (n < n_) {
				n *= 2;
			}
			sum = new int[2 * n - 1];
		}

		void add(int k) {
			k += n - 1;
			++sum[k];
			while (k > 0) {
				k = (k - 1) / 2;
				sum[k] = sum[2 * k + 1] + sum[2 * k + 2];
			}
		}

		int query(int a, int b) {
			return query(0, n, a, b, 0);
		}

		int query(int l, int r, int a, int b, int k) {
			if (r <= a || b <= l)
				return 0;
			else if (a <= l && r <= b)
				return sum[k];
			else {
				return query(l, (l + r) / 2, a, b, 2 * k + 1) + query((l + r) / 2, r, a, b, 2 * k + 2);
			}
		}
	}

	void tr(Object... objects) {
		System.out.println(Arrays.deepToString(objects));
	}

	public static void main(String[] args) throws FileNotFoundException {
		new Main().run();
	}
}
0