codechef May Challenge 2016 LADDU: Ladd 模拟
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
- 1 ≤ T, activities ≤ 100
- 1 ≤ rank ≤ 5000
- 50 ≤ severity ≤ 1000
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
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
#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 模拟的更多相关文章
- codechef May Challenge 2016 CHSC: Che and ig Soccer dfs处理
Description All submissions for this problem are available. Read problems statements in Mandarin Chi ...
- codechef May Challenge 2016 FORESTGA: Forest Gathering 二分
Description All submissions for this problem are available. Read problems statements in Mandarin Chi ...
- Codechef October Challenge 2018 游记
Codechef October Challenge 2018 游记 CHSERVE - Chef and Serves 题目大意: 乒乓球比赛中,双方每累计得两分就会交换一次发球权. 不过,大厨和小 ...
- Codechef September Challenge 2018 游记
Codechef September Challenge 2018 游记 Magician versus Chef 题目大意: 有一排\(n(n\le10^5)\)个格子,一开始硬币在第\(x\)个格 ...
- Codechef April Challenge 2019 游记
Codechef April Challenge 2019 游记 Subtree Removal 题目大意: 一棵\(n(n\le10^5)\)个结点的有根树,每个结点有一个权值\(w_i(|w_i\ ...
- codechef February Challenge 2018 简要题解
比赛链接:https://www.codechef.com/FEB18,题面和提交记录是公开的,这里就不再贴了 Chef And His Characters 模拟题 Chef And The Pat ...
- Codechef November Challenge 2019 Division 1
Preface 这场CC好难的说,后面的都不会做QAQ 还因为不会三进制位运算卷积被曲明姐姐欺负了,我真是太菜了QAQ PS:最后还是狗上了六星的说,期待两(三)场之内可以上七星 Physical E ...
- codechef January Challenge 2017 简要题解
https://www.codechef.com/JAN17 Cats and Dogs 签到题 #include<cstdio> int min(int a,int b){return ...
- Codechef August Challenge 2019 Division 2
Preface 老年菜鸡终于开始打CC了,由于他太弱了所以只能打Div2 因为台风的原因challenge并没有写,所以水了个Rank7 A Football SB模拟题不解释 #include< ...
随机推荐
- 重温 JSP 与 Servlet
Java Web使用SSH框架多了,很多基础的 JSP 与 Servlet 的东西都忘记了.最近在 JSP 标签 和 Struts2 包装的 Session 对象的混合使用时弄晕了,就翻书温习下. J ...
- IE脚本调试
打开IE -- 工具 -- Internet选项 -- 高级 --有4项. 1.禁用脚本调试(Internet Explorer)(去掉对勾) 2.禁用脚本调试(其他)(去掉对勾) 3.显示每个脚本错 ...
- java算法面试题:设计一个快速排序。双路快速排序,简单易于理解。
package com.swift; import java.util.ArrayList; import java.util.Collections; import java.util.Compar ...
- Windows 下编辑 hosts 文件
hosts 文件目录: C:\WINDOWS\system32\drivers\etc\hosts hosts是一个没有扩展名的系统文件,可以用记事本等工具打开,其作用就是将一些常用的网址域名与其对应 ...
- 全文检索ES 服务启动和关闭
nohup ./elasticsearch & 可以后台开启elasticsearch服务 ps-ef列出所有进程 ps-ef | grep elastic...查找elastic..的进程 ...
- C语言:自己编写的简易ftp客户端,包含(列表,进入目录,上传文件,下载文件,删除文件)功能
//简易ftp客户端#include <stdio.h> #include <string.h> #include <sys/types.h> #include & ...
- Install Jenkins 2.1.36 and openjdk 1.7.0 on centos 7
#!/bin/bash## Copyright (c) 2014-2015 Michael Dichirico (https://github.com/mdichirico)# This softwa ...
- php - 去除php代码中的多余空格
<?php class Test{ public function test(){ $tmplContent = file_get_contents('./test.php'); $tmplCo ...
- 【php】如何配置自主域名腾讯企业邮箱
腾讯企业邮配置 protocal ssl smtp port 465 host smtp.exmail.qq.com user email account passwd email passwd
- GoF23种设计模式之创建型模式之原型模式
一.概述 用原型实例指定创建对象的种类,并且通过拷贝这些原型创建新的对象. 二.适用性 1.当一个系统应该独立于它的产品创建.构成和表示的时候. 2.当要实例化的类是在运行时刻指定的时候,例如:通过动 ...