-
Notifications
You must be signed in to change notification settings - Fork 7
/
Main.java
54 lines (43 loc) · 1016 Bytes
/
Main.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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
package basicLevel1024;
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
String[] sci = in.nextLine().split("[.E]");
in.close();
int eff = Integer.parseInt(sci[0]);
int pow = Integer.parseInt(sci[2]);
if (pow >= 0) {
System.out.print(eff);
boolean havePoint = true;
if (sci[1].length() <= pow) {
havePoint = false;
}
int i = 0;
for (i = 0; i < sci[1].length() && pow != 0; i++, pow--) {
System.out.print(sci[1].charAt(i));
}
if (havePoint) {
System.out.print(".");
for (; i < sci[1].length(); i++) {
System.out.print(sci[1].charAt(i));
}
}
while (pow != 0) {
System.out.print("0");
pow--;
}
} else {
if (eff < 0) {
System.out.print("-");
eff = -eff;
}
System.out.print("0.");
for (int i = 1; i < Math.abs(pow); i++) {
System.out.print("0");
}
System.out.print(eff);
System.out.print(sci[1]);
}
}
}