-
Notifications
You must be signed in to change notification settings - Fork 0
/
FallInt.java
34 lines (28 loc) · 870 Bytes
/
FallInt.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
import java.io.*;
class FallInt {
public static void main(String args[]) {
int x, y, x_speed, y_speed;
int g;
g = -10000;
x = 0;
y = 100000;
x_speed = 0;
y_speed = 0;
String buf;
try{
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
buf = br.readLine();
x_speed = Integer.parseInt(buf);
while( y >= 0 ) {
y_speed = y_speed + g/5000;
x = x + x_speed/5000;
y = y + y_speed/5000;
}
System.out.print("estimated distance = " + x + "\n");
}
catch(Exception e) {
System.out.print("Error:" + e);
}
return;
}
}