隐藏比较深的模拟题1003: UC Browser

1003: UC Browser

Time Limit: 1 Sec   Memory Limit: 128 MB
Submit: 1912   Solved: 644
[ Submit][ Status]

Description

Brother Xi has recently bought a smart mobile phone. Nowhe surfs Internet by his mobile phone almost every day. The browser that heuses is UC Browser, which is one of the most popular mobile browsers. To bettergrasp the users, UC Corporation have also brought out the level system of useraccount. The higher the level of your account, the more privileges you canenjoy. The level of your account is calculated by your experiences. Thecorrespondence of level and experience is as follows:


Level Experiences Level Experiences Level Experiences
0 0-49 3 250-349 6 550-649
1 50-149 4 350-449 7 650-749
2 150-249 5 450-549 8 >=750


You can get 10 experiences after using UC Browser one dayin a row, 20 experiences for two days in a row, 30 experiences for three daysin a row, 40 experiences for four days in a row, 50 experiences for five daysin a row. If you use UC Browser six days in a row, the experiences you can getwill be equal 10, like your using UC Browser one day in a row. It’s come backto the starting of your using UC Browser. It’s a circle.

 Now you have known the Xi’s record of using UC Browser, I’ll hope you calculatethe level of Xi’s account.

Input


The first line of the input contains a single integer T (0

Output


For each test case, output the corresponding level of Xi’s account in one line.

Sample Input

2
6
110101
12
111111110101

Sample Output

1
2

HINT

Source

中南大学第五届大学生程序设计竞赛-热身赛

[ Submit][ Status]


解题思路:对于想这一类型的模拟题,首先必须要理清思路,然后对各种数据结构都要比较熟悉,同时要较强的代码能力,否则就jj了。


#include
using namespace std;

int main()
{
    int t;
    cin >> t;
    int n;
    for(int i = 0; i < t; i++)
    {
        cin >> n;
        char*uc = new char[n];
        cin >> uc;
        int j = 0;
        int score = 0;
        for(j=0; j < n;j++ )
        {
            int number = 0;
            while(uc[j] == '0'&&j < n)j++;
            while(uc[j] == '1'&&j < n)
            {
                number++;
                j++;
                int num = number % 5;
                int point = 50;
                if(num)point = 10 * num;
                score += point;
            }
        }
        if(score >= 750)cout << 8;
        else if (score < 50)cout << 0;
        else cout << (score + 50) / 100;
        cout << endl;
    }
    return 0;
}


你可能感兴趣的:(模拟题)