結果
問題 | No.741 AscNumber(Easy) |
ユーザー | AreTrash |
提出日時 | 2018-10-11 03:47:26 |
言語 | C#(csc) (csc 3.9.0) |
結果 |
AC
|
実行時間 | 53 ms / 2,000 ms |
コード長 | 3,064 bytes |
コンパイル時間 | 915 ms |
コンパイル使用メモリ | 113,488 KB |
実行使用メモリ | 32,764 KB |
最終ジャッジ日時 | 2024-10-12 17:31:54 |
合計ジャッジ時間 | 3,563 ms |
ジャッジサーバーID (参考情報) |
judge / judge2 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 19 ms
23,728 KB |
testcase_01 | AC | 19 ms
23,680 KB |
testcase_02 | AC | 19 ms
23,724 KB |
testcase_03 | AC | 19 ms
23,640 KB |
testcase_04 | AC | 19 ms
23,544 KB |
testcase_05 | AC | 20 ms
23,796 KB |
testcase_06 | AC | 20 ms
25,592 KB |
testcase_07 | AC | 19 ms
23,908 KB |
testcase_08 | AC | 20 ms
23,776 KB |
testcase_09 | AC | 19 ms
23,672 KB |
testcase_10 | AC | 19 ms
23,772 KB |
testcase_11 | AC | 20 ms
25,592 KB |
testcase_12 | AC | 20 ms
23,524 KB |
testcase_13 | AC | 20 ms
25,584 KB |
testcase_14 | AC | 19 ms
23,648 KB |
testcase_15 | AC | 19 ms
23,940 KB |
testcase_16 | AC | 21 ms
23,724 KB |
testcase_17 | AC | 20 ms
23,648 KB |
testcase_18 | AC | 20 ms
23,784 KB |
testcase_19 | AC | 18 ms
23,920 KB |
testcase_20 | AC | 19 ms
23,648 KB |
testcase_21 | AC | 19 ms
23,928 KB |
testcase_22 | AC | 19 ms
23,788 KB |
testcase_23 | AC | 19 ms
21,424 KB |
testcase_24 | AC | 20 ms
23,600 KB |
testcase_25 | AC | 19 ms
23,644 KB |
testcase_26 | AC | 20 ms
25,720 KB |
testcase_27 | AC | 19 ms
26,076 KB |
testcase_28 | AC | 19 ms
23,796 KB |
testcase_29 | AC | 20 ms
24,028 KB |
testcase_30 | AC | 20 ms
23,856 KB |
testcase_31 | AC | 19 ms
23,676 KB |
testcase_32 | AC | 19 ms
25,720 KB |
testcase_33 | AC | 19 ms
23,536 KB |
testcase_34 | AC | 19 ms
23,420 KB |
testcase_35 | AC | 50 ms
32,392 KB |
testcase_36 | AC | 34 ms
28,196 KB |
testcase_37 | AC | 36 ms
27,060 KB |
testcase_38 | AC | 36 ms
26,508 KB |
testcase_39 | AC | 33 ms
26,220 KB |
testcase_40 | AC | 38 ms
27,428 KB |
testcase_41 | AC | 47 ms
31,876 KB |
testcase_42 | AC | 35 ms
24,500 KB |
testcase_43 | AC | 32 ms
25,648 KB |
testcase_44 | AC | 42 ms
26,404 KB |
testcase_45 | AC | 44 ms
30,940 KB |
testcase_46 | AC | 50 ms
30,172 KB |
testcase_47 | AC | 25 ms
24,284 KB |
testcase_48 | AC | 50 ms
30,184 KB |
testcase_49 | AC | 46 ms
30,748 KB |
testcase_50 | AC | 26 ms
23,780 KB |
testcase_51 | AC | 34 ms
25,776 KB |
testcase_52 | AC | 53 ms
30,720 KB |
testcase_53 | AC | 53 ms
32,764 KB |
testcase_54 | AC | 52 ms
28,656 KB |
コンパイルメッセージ
Microsoft (R) Visual C# Compiler version 3.9.0-6.21124.20 (db94f4cc) Copyright (C) Microsoft Corporation. All rights reserved.
ソースコード
using System; namespace No741_Ex { public class Program { public static void Main(string[] args) { var N = int.Parse(Console.ReadLine()); var comb = new Combination(N + 10); Console.WriteLine(comb.NCK(N + 9, 9)); } } public class Combination { readonly ModInt[] facts; public Combination(int max) { facts = new ModInt[max + 1]; facts[0] = 1; for (var i = 1; i <= max; i++) facts[i] = facts[i - 1] * i; } public ModInt Fact(int n) { return facts[n]; } public ModInt NCK(int n, int k) { if (n < k) return 0; return facts[n] / facts[k] / facts[n - k]; } public ModInt NPK(int n, int k) { if (n < k) return 0; return facts[n] / facts[n - k]; } public ModInt NHK(int n, int k) { if (k == 0) return 1; if (n == 0) return 0; return facts[n + k - 1] / facts[k] / facts[n - 1]; } } public struct ModInt { public static int Mod = 1000000007; readonly long value; public int Value { get { return (int)value; } } public ModInt Inverse { get { return GetInverse(); } } public ModInt(long value) { value %= Mod; this.value = value < 0 ? value + Mod : value; } ModInt GetInverse() { if (value == 0) throw new InvalidOperationException("value must NOT equal 0"); return Pow(Mod - 2); } public ModInt Square() { return this * this; } public ModInt Pow(long exp) { if (exp == 0) return 1; if (exp % 2 == 0) return Pow(exp / 2).Square(); return this * Pow(exp - 1); } public static ModInt Parse(string str) { return long.Parse(str); } public static implicit operator ModInt(long value) { return new ModInt(value); } public static ModInt operator +(ModInt left, ModInt right) { return left.value + right.value; } public static ModInt operator -(ModInt left, ModInt right) { return left.value - right.value; } public static ModInt operator *(ModInt left, ModInt right) { return left.value * right.value; } public static ModInt operator /(ModInt left, ModInt right) { return left * right.Inverse; } public override bool Equals(object obj) { if (!(obj is ModInt)) return false; return value == ((ModInt)obj).value; } public override int GetHashCode() { return value.GetHashCode(); } public override string ToString() { return value.ToString(); } } }