zoukankan      html  css  js  c++  java
  • 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

    • 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
    题解:模拟
     1 #include<iostream>
     2 #include<cstring>
     3 #include<cstdio>
     4 using namespace std;
     5 int t;
     6 int n;
     7 char b[105];
     8 char a[105];
     9 int main()
    10 {
    11     while(scanf("%d",&t)!=EOF)
    12     {
    13     for(int i=1;i<=t;i++)
    14     {
    15         memset(a,0,sizeof(a));
    16         memset(b,0,sizeof(b));
    17         scanf("%d %s",&n,a);
    18         int sum=0;
    19         sum=0;
    20         for(int j=1;j<=n;j++)
    21         {
    22             scanf("%s",b);
    23             if(strcmp(b,"CONTEST_WON")==0)
    24             {
    25                 int exm;
    26                 scanf("%d",&exm);
    27                 sum=sum+300;
    28                 if(exm<=20)
    29                 sum=sum+20-exm;
    30             }
    31            if(strcmp(b,"TOP_CONTRIBUTOR")==0)
    32             {
    33                 sum+=300;
    34             }
    35             if(strcmp(b,"BUG_FOUND")==0)
    36             {
    37                 int exm;
    38                 scanf("%d",&exm);
    39                 sum=sum+exm;
    40             }
    41             if(strcmp(b,"CONTEST_HOSTED")==0)
    42             {
    43                 sum+=50;
    44             }
    45         }
    46            if(strcmp(a,"INDIAN")==0)
    47                 cout<<sum/200<<endl;
    48             else
    49                 cout<<sum/400<<endl;
    50     }
    51     }
    52     return 0;
    53 }
  • 相关阅读:
    docker for windows 中挂载文件到容器
    docker for windows 中 镜像 microsoft/donet 的文件结构
    window7下docker toolbox 启用数据卷报错: Error response from daemon: invalid mode:
    无法创建虚拟目录
    docker 内时区和宿主机差8个小时,怎么办?
    多线程之同时更改数据问题--启用lock
    Linux shell Bash的基本功能1
    Linux shell 脚本执行方式
    Linux vim编辑器使用技巧
    Linux vim编辑器命令
  • 原文地址:https://www.cnblogs.com/hsd-/p/5667319.html
Copyright © 2011-2022 走看看