Submission #935528
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(); } void run() { long a = sc.nextLong(); long k = sc.nextLong(); long TRG = 2_000_000_000_000L; if (k == 0) { System.out.println(TRG - a); } else { long cnt = 0; while(a < TRG) { a += 1L + k * a; ++cnt; } System.out.println(cnt); } } 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; } } */ 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; } }
Submission Info
Submission Time | |
---|---|
Task | A - 2兆円 |
User | arukuka |
Language | Java8 (OpenJDK 1.8.0) |
Score | 100 |
Code Size | 2008 Byte |
Status | AC |
Exec Time | 135 ms |
Memory | 9796 KB |
Judge Result
Set Name | Sample | All | ||||
---|---|---|---|---|---|---|
Score / Max Score | 0 / 0 | 100 / 100 | ||||
Status |
|
|
Set Name | Test Cases |
---|---|
Sample | s1.txt, s2.txt, s3.txt |
All | 01.txt, 02.txt, 03.txt, 04.txt, 05.txt, 06.txt, 07.txt, 08.txt, 09.txt, 10.txt, 11.txt, 12.txt, 13.txt, s1.txt, s2.txt, s3.txt |
Case Name | Status | Exec Time | Memory |
---|---|---|---|
01.txt | AC | 131 ms | 9684 KB |
02.txt | AC | 130 ms | 9684 KB |
03.txt | AC | 131 ms | 9684 KB |
04.txt | AC | 129 ms | 9684 KB |
05.txt | AC | 130 ms | 9684 KB |
06.txt | AC | 130 ms | 9680 KB |
07.txt | AC | 129 ms | 9556 KB |
08.txt | AC | 130 ms | 9684 KB |
09.txt | AC | 129 ms | 9556 KB |
10.txt | AC | 129 ms | 9680 KB |
11.txt | AC | 130 ms | 9680 KB |
12.txt | AC | 135 ms | 9684 KB |
13.txt | AC | 130 ms | 9684 KB |
s1.txt | AC | 130 ms | 9680 KB |
s2.txt | AC | 134 ms | 9680 KB |
s3.txt | AC | 132 ms | 9796 KB |