Skip to content

Commit 38865a3

Browse files
committed
.
1 parent 1635f1a commit 38865a3

File tree

1 file changed

+293
-0
lines changed
  • AtCoder Beginner Contest 176

1 file changed

+293
-0
lines changed

AtCoder Beginner Contest 176/a.java

Lines changed: 293 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,293 @@
1+
import java.text.DecimalFormat;
2+
import java.util.stream.LongStream;
3+
import java.util.stream.IntStream;
4+
import java.io.*;
5+
import java.util.*;
6+
7+
public class Main {
8+
9+
public static void main(String[] args) {
10+
FastScanner sc = new FastScanner();
11+
PrintWriter out = new PrintWriter(System.out);
12+
13+
AtCoder problem = new AtCoder(sc);
14+
problem.solve(sc, out);
15+
16+
out.flush();
17+
}
18+
19+
}
20+
21+
class AtCoder {
22+
23+
int N, X, T;
24+
25+
AtCoder(FastScanner sc) {
26+
N = sc.nextInt();
27+
X = sc.nextInt();
28+
T = sc.nextInt();
29+
}
30+
31+
void solve(FastScanner sc, PrintWriter out) {
32+
int time=T;
33+
while(X < N){
34+
N -= X;
35+
time += T;
36+
}
37+
System.out.println(time);
38+
39+
}
40+
41+
}
42+
43+
class FastScanner {
44+
45+
private final InputStream in = System.in;
46+
private final byte[] buffer = new byte[1024];
47+
private int ptr = 0;
48+
private int buflen = 0;
49+
50+
private boolean hasNextByte() {
51+
if (ptr < buflen) {
52+
return true;
53+
} else {
54+
ptr = 0;
55+
try {
56+
buflen = in.read(buffer);
57+
} catch (IOException e) {
58+
e.printStackTrace();
59+
}
60+
if (buflen <= 0) {
61+
return false;
62+
}
63+
}
64+
return true;
65+
}
66+
67+
private int readByte() {
68+
if (hasNextByte()) {
69+
return buffer[ptr++];
70+
} else {
71+
return -1;
72+
}
73+
}
74+
75+
private static boolean isPrintableChar(int c) {
76+
return 33 <= c && c <= 126;
77+
}
78+
79+
public boolean hasNext() {
80+
while (hasNextByte() && !isPrintableChar(buffer[ptr])) {
81+
ptr++;
82+
}
83+
return hasNextByte();
84+
}
85+
86+
public String next() {
87+
if (!hasNext()) {
88+
throw new NoSuchElementException();
89+
}
90+
StringBuilder sb = new StringBuilder();
91+
int b = readByte();
92+
while (isPrintableChar(b)) {
93+
sb.appendCodePoint(b);
94+
b = readByte();
95+
}
96+
return sb.toString();
97+
}
98+
99+
public long nextLong() {
100+
if (!hasNext()) {
101+
throw new NoSuchElementException();
102+
}
103+
long n = 0;
104+
boolean minus = false;
105+
int b = readByte();
106+
if (b == '-') {
107+
minus = true;
108+
b = readByte();
109+
}
110+
if (b < '0' || '9' < b) {
111+
throw new NumberFormatException();
112+
}
113+
while (true) {
114+
if ('0' <= b && b <= '9') {
115+
n *= 10;
116+
n += b - '0';
117+
} else if (b == -1 || !isPrintableChar(b)) {
118+
return minus ? -n : n;
119+
} else {
120+
throw new NumberFormatException();
121+
}
122+
b = readByte();
123+
}
124+
}
125+
126+
public int nextInt() {
127+
long nl = nextLong();
128+
if (nl < Integer.MIN_VALUE || nl > Integer.MAX_VALUE) {
129+
throw new NumberFormatException();
130+
}
131+
return (int) nl;
132+
}
133+
134+
public double nextDouble() {
135+
return Double.parseDouble(next());
136+
}
137+
138+
public int[] arrayInt(int N) {
139+
int[] array = new int[N];
140+
for (int i = 0; i < N; i++) {
141+
array[i] = nextInt();
142+
}
143+
return array;
144+
}
145+
146+
public long[] arrayLong(int N) {
147+
long[] array = new long[N];
148+
for (int i = 0; i < N; i++) {
149+
array[i] = nextLong();
150+
}
151+
return array;
152+
}
153+
154+
public double[] arrayDouble(int N) {
155+
double[] array = new double[N];
156+
for (int i = 0; i < N; i++) {
157+
array[i] = nextDouble();
158+
}
159+
return array;
160+
}
161+
162+
public String[] arrayString(int N) {
163+
String[] array = new String[N];
164+
for (int i = 0; i < N; i++) {
165+
array[i] = next();
166+
}
167+
return array;
168+
}
169+
170+
public int randomInt() {
171+
Random r = new Random();
172+
int value = r.nextInt((int) 1e6);
173+
System.out.println(value);
174+
return value;
175+
}
176+
177+
public int[] randomInt(int N) {
178+
int[] array = new int[N];
179+
Random r = new Random();
180+
for (int i = 0; i < N; i++) {
181+
array[i] = r.nextInt((int) 1e6);
182+
}
183+
System.out.println(Arrays.toString(array));
184+
return array;
185+
}
186+
187+
}
188+
189+
class My {
190+
191+
static void ans(boolean b) {
192+
System.out.println(b ? "Yes" : "No");
193+
}
194+
195+
static void ANS(boolean b) {
196+
System.out.println(b ? "YES" : "NO");
197+
}
198+
199+
static String sort(String s) {
200+
char[] ch = s.toCharArray();
201+
Arrays.sort(ch);
202+
return String.valueOf(ch);
203+
}
204+
205+
static String reverse(String s) {
206+
return new StringBuilder(s).reverse().toString();
207+
}
208+
209+
static int[] reverse(int[] array) {
210+
for (int i = 0; i < array.length / 2; i++) {
211+
int temp = array[i];
212+
array[i] = array[array.length - 1 - i];
213+
array[array.length - 1 - i] = temp;
214+
}
215+
return array;
216+
}
217+
218+
static long[] reverse(long[] array) {
219+
for (int i = 0; i < array.length / 2; i++) {
220+
long temp = array[i];
221+
array[i] = array[array.length - 1 - i];
222+
array[array.length - 1 - i] = temp;
223+
}
224+
return array;
225+
}
226+
227+
static double[] reverse(double[] array) {
228+
for (int i = 0; i < array.length / 2; i++) {
229+
double temp = array[i];
230+
array[i] = array[array.length - 1 - i];
231+
array[array.length - 1 - i] = temp;
232+
}
233+
return array;
234+
}
235+
236+
static String[] reverse(String[] array) {
237+
for (int i = 0; i < array.length / 2; i++) {
238+
String temp = array[i];
239+
array[i] = array[array.length - 1 - i];
240+
array[array.length - 1 - i] = temp;
241+
}
242+
return array;
243+
}
244+
245+
static char[] reverse(char[] array) {
246+
for (int i = 0; i < array.length / 2; i++) {
247+
char temp = array[i];
248+
array[i] = array[array.length - 1 - i];
249+
array[array.length - 1 - i] = temp;
250+
}
251+
return array;
252+
}
253+
254+
static long min(long... numbers) {
255+
Arrays.sort(numbers);
256+
return numbers[0];
257+
}
258+
259+
static int min(int... numbers) {
260+
Arrays.sort(numbers);
261+
return numbers[0];
262+
}
263+
264+
static double min(double... numbers) {
265+
Arrays.sort(numbers);
266+
return numbers[0];
267+
}
268+
269+
static long max(long... numbers) {
270+
Arrays.sort(numbers);
271+
return numbers[numbers.length - 1];
272+
}
273+
274+
static int max(int... numbers) {
275+
Arrays.sort(numbers);
276+
return numbers[numbers.length - 1];
277+
}
278+
279+
static double max(double... numbers) {
280+
Arrays.sort(numbers);
281+
return numbers[numbers.length - 1];
282+
}
283+
284+
static int sum(long number) {
285+
int sum = 0;
286+
while (number > 0) {
287+
sum += number % 10;
288+
number /= 10;
289+
}
290+
return sum;
291+
}
292+
293+
}

0 commit comments

Comments
 (0)