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. C#事件与接口编程实例

    很多初学c#的朋友对于事件与接口感到迷惑不解,不明白它们之间的关系,下面我就用实例来简单的分析讲解一下. 事件,用event修饰符来代表一个事件,我们要创建一个C#事件必须按以下顺序来扫行: 1,创建 ...

  2. windows下简单使用pip

    1. 在python官网上下载python时会自带pip,并且在安装Python时若未取消会默认一并安装 2. 找出pip.exe所在位置, 3. 右击此电脑,点击属性 4. 高级系统设置 5. 点击 ...

  3. pyhon之99乘法表

    1.长方形完整格式 for i in range(1,10): for j in range(1,10): print("%d*%d" %(j,i),end=" &quo ...

  4. Centos 6版本Device eth0 does not seem to be present,delaying initialization.故障处理

    1.1  故障现象 2019年06月14日晚上,公司项目组说有台业务服务器连接不上,比较着急,我通过vpn拨入的方式远程登录到管理控制台查看发现网卡没有获取到IP地址,我尝试重启来重新启动,重启的时候 ...

  5. php 多维数组指定某个值作为键

    $temp_key = array_column($mobile_arr,'cidf'); //键值 $mobile_arr = array_combine($temp_key,$mobile_arr ...

  6. python3.7 random模块

    #!/usr/bin/env python __author__ = "lrtao2010" #python3.7 random模块 import random #随机模块 # r ...

  7. U1

    如果 activity_main.xml没有xml代码可以对图像右键 go to mxl同时可以在design  和  text  切换 在安装了Android Studio3.3版本之后,第一个He ...

  8. 2018年江西理工大学C语言程序设计竞赛(高级组) 三角平方数

    题目描述 三角数:形如图a,圆点摆放成等边三角形的数字,则为三角数. (图a) 平方数:形如图b,小方块摆放成正方形的数字,则为平方数. (图b) 那么如果一个数字既是三角形数又是平方数,则称为三角平 ...

  9. Js中的undefined和not defined

    1.undefined 已经声明,但未赋值 2.not defined 未声明,报错

  10. luoguT30204 偷上网

    \(n=1\) 时特判四角,其余时刻圆的面积和必小于正方形面积,随机点出来判断就行了. stm 随机算法-- #include <iostream> #include <cstdli ...