-
Notifications
You must be signed in to change notification settings - Fork 0
/
CommTest.java
57 lines (52 loc) · 1.69 KB
/
CommTest.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
55
56
57
package commtest;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.logging.Level;
import java.util.logging.Logger;
public class CommTest {
public static void main(String[] args) {
TestTwo();
}
public static void TestOne(){
BufferedReader Read=new BufferedReader(new InputStreamReader(System.in)); //Creates a reader to read inputs
try {
while(true){
String line=Read.readLine(); //Reads in input
System.out.println("You wrote " + line); // outputs what was sent
}
} catch (IOException ex) {
System.out.println(" IOException");
}
}
public static void TestTwo(){
BufferedReader Read=new BufferedReader(new InputStreamReader(System.in));
String[] inputs;
String line;
int temp;
int count=0;
try {
while(true){
count=0;
line=Read.readLine(); //Reads in input
inputs=line.split(",");
for(int i=3;i<29;i++){
if((temp=Integer.parseInt(inputs[i]))>=0){
count+=temp*(29-i);
}
else{
count+=temp*(i-3);
}
}
if(count>0){
System.out.println("N");
}
else{
System.out.println("Y");
}
}
} catch (IOException ex) {
System.out.println(" IOException");
}
}
}