-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathLaddu.java
More file actions
59 lines (50 loc) · 1.63 KB
/
Laddu.java
File metadata and controls
59 lines (50 loc) · 1.63 KB
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
58
59
package problems.codechef;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
/**
* Created by hardCode on 5/16/2016.
*/
//problem link: https://www.codechef.com/MAY16/problems/LADDU
public class Laddu {
static BufferedReader br;
static final String S_1="CONTEST_WON";
static final String S_2="TOP_CONTRIBUTOR";
static final String S_3="BUG_FOUND";
static final String S_4="CONTEST_HOSTED";
public static void main(String[] args) throws IOException {
int t;
String s[];
br=new BufferedReader(new InputStreamReader(System.in));
t=Integer.parseInt(br.readLine());
while (t-->0){
s=br.readLine().split("\\s");
System.out.println(solve(Integer.parseInt(s[0]),s[1]));
}
}
private static int solve(int activities, String origin) throws IOException {
String s[]=null;
int sum=0;
for (int i = 0; i < activities; i++) {
s=br.readLine().split("\\s");
switch (s[0]){
case S_1:
sum+=300;
int rank=Integer.parseInt(s[1]);
if (rank<=20)sum+=20-rank;
break;
case S_2:
sum+=300;break;
case S_3:
sum+=Integer.parseInt(s[1]);
break;
case S_4:
sum+=50;
break;
default:break;
}
}
//System.out.println(origin.equals("INDIAN"));
return ((origin.equals("INDIAN"))?(sum/200):(sum/400));
}
}