Bnu49101:rating calculation

Source: Internet
Author: User

Whalyzh recently participated in a competition called BC (BNU Coder), which is divided into N-Fields. Participating in each account has a rating, the initial rating value is 1500, after each game the system will evaluate the participant's account, if the evaluation is good, then the account rating increase 100 points, but not more than 3299, if the evaluation of bad, The account rating down 100 points, but not less than 0 points. In order to avoid the lower the rating, Whalyzh registered two accounts, each game he will only use rating low account (if rating like a casual use). Now, he wants to know how much of the account rating is rating high after n games. Input

There are multiple sets of input data.

The first line enters an integer T (t≤10) that represents the number of data groups.

The first behavior of each group of data is two integer N (n≤10^3), which represents the number of matches.

The next n rows are a string good or bad for each row, representing the evaluation that Whalyzh obtained during the game. Output

Each set of data outputs a number that represents the rating value of the rating high account. Sample Input

2
2
good
good
2
good
bad
Sample Output
1600
Source13th session of Beijing Normal University program design competition finals AuthorHwq

#include <iostream> #include <stdio.h> #include <string.h> #include <stack> #include <queue&
Gt
#include <map> #include <set> #include <vector> #include <math.h> #include <algorithm>
using namespace Std; #define LS 2*i #define RS 2*i+1 #define UP (i,x,y) for (i=x;i<=y;i++) #define OFF (i,x,y) for (i=x;i>=y;i--) #define Me
M (a,x) memset (A,x,sizeof (a)) #define W (a) while (a) #define LL long Long const double PI = ACOs (-1.0);
#define N #define MOD 19999997 const int INF = 0X3F3F3F3F;
#define EXP 1e-8 int t,n;

Char str[100];
    int main () {int s[2];
    scanf ("%d", &t);
        W (t--) {scanf ("%d", &n);
        S[0] = s[1] = 1500;
            W (n--) {scanf ("%s", str);
            if (str[0]== ' G ') {s[0]+=100;
            } else {s[0]-=100;
            } sort (s,s+2);
          s[0]=s[0]>3299?3299:s[0];  s[0]=s[0]<0?0:s[0];
            s[1]=s[1]>3299?3299:s[1];
        s[1]=s[1]<0?0:s[1];
        } sort (s,s+2);
    printf ("%d\n", s[1]); }
}


Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.