-
Notifications
You must be signed in to change notification settings - Fork 19
/
acm.java
47 lines (36 loc) · 840 Bytes
/
acm.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
import java.util.Scanner;
public class acm {
public static int num(String str) {
return (int)(str.charAt(0) - 65);
}
public static void main(String[] args) {
Scanner scan = new Scanner(System.in);
int[] nums = new int[26];
boolean[] solved = new boolean[26];
int time = 0;
int problems = 0;
while (true)
{
int min = scan.nextInt();
if (min == -1)
break;
String prob = scan.next();
String corr = scan.next();
if (corr.equals("right"))
{
nums[num(prob)] += min;
solved[num(prob)] = true;
}
if (corr.equals("wrong"))
nums[num(prob)] += 20;
}
for (int i = 0; i < nums.length; i++)
if (solved[i])
{
time += nums[i];
problems++;
}
System.out.println(problems + " " + time);
scan.close();
}
}