All submissions for this problem are available.

Read problems statements in Mandarin Chinese, Russian and Vietnamese as well.

You might have heard about our new goodie distribution program aka the "Laddu Accrual System". This problem is designed to give you a glimpse of its rules. You can read the page once before attempting the problem if you wish, nonetheless we will be providing all the information needed here itself.

Laddu Accrual System is our new goodie distribution program. In this program, we will be distributing Laddus in place of goodies for your winnings and various other activities (described below), that you perform on our system. Once you collect enough number of Laddus, you can then redeem them to get yourself anything from a wide range of CodeChef goodies.

Let us know about various activities and amount of laddus you get corresponding to them.

  • Contest Win (CodeChef’s Long, Cook-Off, LTIME, or any contest hosted with us) : 300 + Bonus (Bonus = 20 - contest rank). Note that if your rank is > 20, then you won't get any bonus.
  • Top Contributor on Discuss : 300
  • Bug Finder : 50 - 1000 (depending on the bug severity). It may also fetch you a CodeChef internship!
  • Contest Hosting : 50

You can do a checkout for redeeming laddus once a month. The minimum laddus redeemable at Check Out are 200 for Indians and 400 for the rest of the world.

You are given history of various activities of a user. The user has not redeemed any of the its laddus accrued.. Now the user just wants to redeem as less amount of laddus he/she can, so that the laddus can last for as long as possible. Find out for how many maximum number of months he can redeem the laddus.

Input

  • The first line of input contains a single integer T denoting number of test cases
  • For each test case:
    • First line contains an integer followed by a string denoting activities, origin respectively, where activities denotes number of activities of the user, origin denotes whether the user is Indian or the rest of the world. origin can be "INDIAN" or "NON_INDIAN".
    • For each of the next activities lines, each line contains an activity.
      An activity can be of four types as defined above.
      • Contest Win : Input will be of form of CONTEST_WON rank, where rank denotes the rank of the user.
      • Top Contributor : Input will be of form of TOP_CONTRIBUTOR.
      • Bug Finder : Input will be of form of BUG_FOUND severity, where severity denotes the severity of the bug.
      • Contest Hosting : Input will be of form of CONTEST_HOSTED.

Output

  • For each test case, find out the maximum number of months for which the user can redeem the laddus accrued.

Constraints

  • 1T, activities100
  • 1rank5000
  • 50severity1000

Subtasks

There is only a single subtask with 100 points.

Example

Input:
2
4 INDIAN
CONTEST_WON 1
TOP_CONTRIBUTOR
BUG_FOUND 100
CONTEST_HOSTED
4 NON_INDIAN
CONTEST_WON 1
TOP_CONTRIBUTOR
BUG_FOUND 100
CONTEST_HOSTED Output:
3
1

Explanation

In the first example,

  • For winning contest with rank 1, user gets 300 + 20 - 1 = 319 laddus.
  • For top contributor, user gets 300 laddus.
  • For finding a bug with severity of 100, user gets 100 laddus.
  • For hosting a contest, user gets 50 laddus.

So, overall user gets 319 + 300 + 100 + 50 = 769 laddus.
Now, the user is an Indian user, he can redeem only 200 laddus per month. So, for first three months, he will redeem 200 * 3 = 600 laddus. The remaining 169 laddus, he can not redeem as he requires at least 200 laddues in a month to redeem.

So, answer is 3.

In the second example, user is a non-Indian user, he can redeem 400 laddues per month. So, in the first month, he will redeem 400 laddus. The remaining 369 laddus, he can not redeem as he requires at least 400 laddues in a month to redeem.

So, answer is 1.

Input

 

Output

 

Sample Input

 

Sample Output

 

Hint

Source Limit: 50000
Languages: ADA, ASM, BASH, BF, C, C99 strict, CAML, CLOJ, CLPS, CPP 4.3.2, CPP 4.9.2, CPP14, CS2, D, ERL, FORT, FS, GO, HASK, ICK, ICON, JAVA, JS, LISP clisp, LISP sbcl, LUA, NEM, NICE, NODEJS, PAS fpc, PAS gpc, PERL, PERL6, PHP, PIKE, PRLG, PYPY, PYTH, PYTH 3.1.2, RUBY, SCALA, SCM chicken, SCM guile, SCM qobi, ST, TCL, TEXT, WSPC
 
题意:中文题面   https://s3.amazonaws.com/codechef_shared/download/translated/MAY16/mandarin/LADDU.pdf
题解:模拟
 #include<iostream>
#include<cstring>
#include<cstdio>
using namespace std;
int t;
int n;
char b[];
char a[];
int main()
{
while(scanf("%d",&t)!=EOF)
{
for(int i=;i<=t;i++)
{
memset(a,,sizeof(a));
memset(b,,sizeof(b));
scanf("%d %s",&n,a);
int sum=;
sum=;
for(int j=;j<=n;j++)
{
scanf("%s",b);
if(strcmp(b,"CONTEST_WON")==)
{
int exm;
scanf("%d",&exm);
sum=sum+;
if(exm<=)
sum=sum+-exm;
}
if(strcmp(b,"TOP_CONTRIBUTOR")==)
{
sum+=;
}
if(strcmp(b,"BUG_FOUND")==)
{
int exm;
scanf("%d",&exm);
sum=sum+exm;
}
if(strcmp(b,"CONTEST_HOSTED")==)
{
sum+=;
}
}
if(strcmp(a,"INDIAN")==)
cout<<sum/<<endl;
else
cout<<sum/<<endl;
}
}
return ;
}

codechef May Challenge 2016 LADDU: Ladd 模拟的更多相关文章

  1. codechef May Challenge 2016 CHSC: Che and ig Soccer dfs处理

    Description All submissions for this problem are available. Read problems statements in Mandarin Chi ...

  2. codechef May Challenge 2016 FORESTGA: Forest Gathering 二分

    Description All submissions for this problem are available. Read problems statements in Mandarin Chi ...

  3. Codechef October Challenge 2018 游记

    Codechef October Challenge 2018 游记 CHSERVE - Chef and Serves 题目大意: 乒乓球比赛中,双方每累计得两分就会交换一次发球权. 不过,大厨和小 ...

  4. Codechef September Challenge 2018 游记

    Codechef September Challenge 2018 游记 Magician versus Chef 题目大意: 有一排\(n(n\le10^5)\)个格子,一开始硬币在第\(x\)个格 ...

  5. Codechef April Challenge 2019 游记

    Codechef April Challenge 2019 游记 Subtree Removal 题目大意: 一棵\(n(n\le10^5)\)个结点的有根树,每个结点有一个权值\(w_i(|w_i\ ...

  6. codechef February Challenge 2018 简要题解

    比赛链接:https://www.codechef.com/FEB18,题面和提交记录是公开的,这里就不再贴了 Chef And His Characters 模拟题 Chef And The Pat ...

  7. Codechef November Challenge 2019 Division 1

    Preface 这场CC好难的说,后面的都不会做QAQ 还因为不会三进制位运算卷积被曲明姐姐欺负了,我真是太菜了QAQ PS:最后还是狗上了六星的说,期待两(三)场之内可以上七星 Physical E ...

  8. codechef January Challenge 2017 简要题解

    https://www.codechef.com/JAN17 Cats and Dogs 签到题 #include<cstdio> int min(int a,int b){return ...

  9. Codechef August Challenge 2019 Division 2

    Preface 老年菜鸡终于开始打CC了,由于他太弱了所以只能打Div2 因为台风的原因challenge并没有写,所以水了个Rank7 A Football SB模拟题不解释 #include< ...

随机推荐

  1. S运算符&&和|| 及其优先级

    a && b : 将a, b转换为Boolean类型, 再执行逻辑与, true返回b, false返回aa || b : 将a, b转换为Boolean类型, 再执行逻辑或, tru ...

  2. WordPress免费清新响应式博客/杂志/图片三合一主题Nana

    WordPress免费清新响应式博客/杂志/图片三合一主题Nana 一.主题安装须知 1.本主题必须安装文章点击统计插件:WP-PostViews,可以直接在后台插件→安装插件中直接搜索安装官方最新版 ...

  3. 第三篇、Swift基础学习

    1.常量与变量 什么是常量和变量 在Swift中规定:在定义一个标识符时必须明确说明该标识符是一个常量还是变量 使用let来定义常量,定义之后不可以修改 使用var来定义变量,定义之后可以修改 变量的 ...

  4. Express框架 --router/app.use

    翻看去年自己记录的印象笔记,准备把笔记上的一些内容也同时更新到博客上,方便自己查看. 1.app.use和app.get的区别及解析 app.use(path,callback)中的callback既 ...

  5. docker安装后无法启动问题

    问题报错: Error starting daemon: Error initializing network controller: list bridge addresses failed: no ...

  6. 【CSS】简略说明css的权重之分

    /*权重 :id > class > 标签 (小环境) 权重:内联 > 内部 > 外部 (大环境) 小环境处于内部环境中 */ <style> #p1{ /* id ...

  7. jquery 省市区联动插件

    使用方式: <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF ...

  8. JZOJ 4725. 质数序列

    Description 由于去NOI的火车“堵”了数不清时间,小Z和小D打完ETG,闲着无聊开始看今年的JSOI省选题,并尝试着修改题目:对于一个长度为L ≥ 2的序列,X:x1,x2,...,xL ...

  9. 学习Pytbon第八天,文件的操作

    文件的常用操作字符 data=open('月亮代表我的心',encoding='utf-8').read() f=open('月亮代表我的心',encoding='utf-8')#提取内存对象也叫文件 ...

  10. Ralph W. Tyler【拉尔夫·泰勒】

    Ralph W. Tyler Anyone who cares about what schools and colleges teach and how their student learn wi ...