Submission #935391
Source Code Expand
import java.util.Arrays; import java.util.Scanner; public class Main { Scanner sc = new Scanner(System.in); public static void main(String[] args) { new Main().run(); } long MOD = 1_000_000_007; long pow(long a, long r) { long sum = 1; while (r > 0) { if ((r & 1) == 1) { sum *= a; sum %= MOD; } a *= a; a %= MOD; r >>= 1; } return sum; } long C(int n, int r) { long sum = 1; for (int i = n; 0 < i; --i) { sum *= i; sum %= MOD; } long s = 1; for (int i = r; 0 < i; --i) { s *= i; s %= MOD; } sum *= pow(s, MOD - 2); sum %= MOD; long t = 1; for (int i = n - r; 0 < i; --i) { t *= i; t %= MOD; } sum *= pow(t, MOD - 2); sum %= MOD; return sum; } void run() { int w = ni() - 1; int h = ni() - 1; int l = w + h; System.out.println(C(l, w)); } int ni() { return Integer.parseInt(sc.next()); } void debug(Object... os) { System.err.println(Arrays.deepToString(os)); } /* class BIT<T> { int n; ArrayList<T> bit; BiFunction<T, T, T> bif; BIT(int n, BiFunction<T, T, T> bif, T defaultValue) { this.n = n; bit = new ArrayList<>(n + 1); for (int i = 0; i < n + 1; ++i) { bit.add(defaultValue); } this.bif = bif; } void update(int i, T v) { for (int x = i; x <= n; x += x & -x) { bit.set(x, bif.apply(bit.get(x), v)); } } T reduce(int i, T defaultValue) { T ret = defaultValue; for (int x = i; x > 0; x -= x & -x) { ret = bif.apply(ret, bit.get(x)); } return ret; } } */ }
Submission Info
Submission Time | |
---|---|
Task | C - 経路 |
User | arukuka |
Language | Java (OpenJDK 1.7.0) |
Score | 101 |
Code Size | 1814 Byte |
Status | AC |
Exec Time | 320 ms |
Memory | 25284 KB |
Judge Result
Set Name | Sample | Dataset1 | Dataset2 | All | ||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
Score / Max Score | 0 / 0 | 50 / 50 | 50 / 50 | 1 / 1 | ||||||||
Status |
|
|
|
|
Set Name | Test Cases |
---|---|
Sample | s0.txt, s1.txt |
Dataset1 | 000.txt, 001.txt, 002.txt, 003.txt, 004.txt, 005.txt, 006.txt, 007.txt, 008.txt, 009.txt, 010.txt, s0.txt |
Dataset2 | 000.txt, 001.txt, 002.txt, 003.txt, 004.txt, 005.txt, 006.txt, 007.txt, 008.txt, 009.txt, 010.txt, 011.txt, 012.txt, 013.txt, 014.txt, 015.txt, 016.txt, 017.txt, 018.txt, 019.txt, 020.txt, 021.txt, s0.txt, s1.txt |
All | 000.txt, 001.txt, 002.txt, 003.txt, 004.txt, 005.txt, 006.txt, 007.txt, 008.txt, 009.txt, 010.txt, 011.txt, 012.txt, 013.txt, 014.txt, 015.txt, 016.txt, 017.txt, 018.txt, 019.txt, 020.txt, 021.txt, 022.txt, 023.txt, 024.txt, 025.txt, 026.txt, 027.txt, 028.txt, 029.txt, 030.txt, 031.txt, 032.txt, s0.txt, s1.txt |
Case Name | Status | Exec Time | Memory |
---|---|---|---|
000.txt | AC | 289 ms | 24024 KB |
001.txt | AC | 304 ms | 23956 KB |
002.txt | AC | 294 ms | 23960 KB |
003.txt | AC | 280 ms | 24056 KB |
004.txt | AC | 291 ms | 23956 KB |
005.txt | AC | 292 ms | 24036 KB |
006.txt | AC | 274 ms | 23932 KB |
007.txt | AC | 275 ms | 23992 KB |
008.txt | AC | 285 ms | 23976 KB |
009.txt | AC | 274 ms | 23992 KB |
010.txt | AC | 274 ms | 24000 KB |
011.txt | AC | 306 ms | 23972 KB |
012.txt | AC | 279 ms | 23936 KB |
013.txt | AC | 277 ms | 24060 KB |
014.txt | AC | 278 ms | 23964 KB |
015.txt | AC | 280 ms | 24048 KB |
016.txt | AC | 279 ms | 23888 KB |
017.txt | AC | 273 ms | 23976 KB |
018.txt | AC | 277 ms | 24056 KB |
019.txt | AC | 277 ms | 23988 KB |
020.txt | AC | 279 ms | 23928 KB |
021.txt | AC | 275 ms | 24056 KB |
022.txt | AC | 308 ms | 25276 KB |
023.txt | AC | 291 ms | 25004 KB |
024.txt | AC | 297 ms | 24876 KB |
025.txt | AC | 292 ms | 24576 KB |
026.txt | AC | 293 ms | 24404 KB |
027.txt | AC | 320 ms | 24868 KB |
028.txt | AC | 305 ms | 25144 KB |
029.txt | AC | 294 ms | 24596 KB |
030.txt | AC | 303 ms | 25108 KB |
031.txt | AC | 305 ms | 24852 KB |
032.txt | AC | 310 ms | 25284 KB |
s0.txt | AC | 286 ms | 23944 KB |
s1.txt | AC | 279 ms | 23988 KB |