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. Restful API 的设计规范

    RESTful 是目前最流行的 API 设计规范,用于 Web 数据接口的设计.降低开发的复杂性,提高系统的可伸缩性. Restful API接口规范包括以下部分: 一.协议 API与用户的通信协议, ...

  2. SqlServer触发器的理解

    SqlServer触发器是与表事件相关的特殊存储过程,它的执行不是由程序调用,也不是手工启动,而是由事件来触发.比如当对一个表进行操作( insert,delete, update)时就会激活它执行. ...

  3. 获取Bing每日壁纸用作首屏大图

    获取Bing每日壁纸用作首屏大图 Bing 搜索每天都会更换一张精美的图片作为壁纸,除了特殊时候不太好看外(比如春节那几天),没多大问题.移动端还有上每日故事,与图片现配.现在我的博客首屏图片就是Bi ...

  4. SpringBoot2.X最佳实践《一》 之 SpringBoot2.x初体验

    SpringBoot2.X最佳实践 前言 本系列文章,从零基础接触  SpringBoot2.x新版本,基础入门使用,热部署,到整合各个主流框架Redis4.x,消息队列AciveMQ, Rocket ...

  5. Android驱动开发读书笔记七

    第七章 (一)创建设备文件 1.使用cdev_init函数初始化cdec 描述设备文件需要一个cdev结构体,代码如下: struct cdev{ struct kobject kobj; struc ...

  6. 洛谷P2908 [USACO08OPEN]文字的力量Word Power

    题目描述 Farmer John wants to evaluate the quality of the names of his N (1 <= N <= 1000) cows. Ea ...

  7. java--creater in windows

    电脑右键--高级--属性--更改环境变量 1.JAVA_HOME  C:\Program Files\Java\jdk1.7.0_04 2. Path                     %JAV ...

  8. python面试题Python2.x和Python3.x的区别

    所属网站分类: 面试经典 > python 作者:外星人入侵 原文链接: http://www.pythonheidong.com/blog/article/22/ 来源:python黑洞网 w ...

  9. Python中字符串String的基本内置函数与过滤字符模块函数的基本用法

    Python中字符串String的基本内置函数与用法 首先我们要明白在python中当字符编码为:UTF-8时,中文在字符串中的占位为3个字节,其余字符为一个字节 下面就直接介绍几种python中字符 ...

  10. hibernate的get() load() 和find()区别

    如果找不到符合条件的纪录,get()方法将返回null.如果找不到符合条件的纪录,find()方法将返回null.如果找不到符合 条件的纪录,load()将会报出ObjectNotFoundEccep ...