CSU-1003
来源:互联网 发布:python 发送邮件附件 编辑:程序博客网 时间:2024/06/16 03:54
1003: UC Browser
Time Limit: 1 Sec Memory Limit: 128 MBSubmit: 1905 Solved: 639
[Submit][Status]
Description
Brother Xi has recently bought a smart mobile phone. Now he surfs Internet by his mobile phone almost every day. The browser that he uses is UC Browser, which is one of the most popular mobile browsers. To better grasp the users, UC Corporation have also brought out the level system of user account. The higher the level of your account, the more privileges you can enjoy. The level of your account is calculated by your experiences. The correspondence of level and experience is as follows:
ExperiencesLevelExperiencesLevelExperiences00-493250-3496550-649150-1494350-4497650-7492150-2495450-5498>=750
You can get 10 experiences after using UC Browser one day in a row, 20 experiences for two days in a row, 30 experiences for three days in a row, 40 experiences for four days in a row, 50 experiences for five days in a row. If you use UC Browser six days in a row, the experiences you can get will be equal 10, like your using UC Browser one day in a row. It’s come back to 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 calculate the level of Xi’s account.
Input
The first line of the input contains a single integer T (0<T<120) which is the number of test cases, followed by 2*T lines. For each test case, the first line is the number of days n (0<n<=100), the second line is a series of 0 and 1. 0 stands for not using UC browser on that day and 1 stands for using UC browser on that day.
Output
For each test case, output the corresponding level of Xi’s account in one line.
Sample Input
2611010112111111110101
Sample Output
12
循环计数即可。
#include <iostream>using namespace std;int main(){int T;cin>>T;while(T--){int day;int exp=0;cin>>day;char a[1000]={0};cin>>a;int times=1;char temp;for(int i=0;i<day;i++){temp=a[i];if(temp=='1'){exp += times * 10;times++;if (times==6)times = 1;}else times=1;}int level = (exp + 50) / 100;if (level > 8)cout << 8 << endl;else cout << level << endl;}return 0;}
- CSU-1003
- CSU 1003 UC Browser
- CSU 1003: UC Browser
- CSU
- CSU
- CSU
- CSU
- CSU
- CSU
- CSU
- CSU
- CSU
- CSU
- CSU
- CSU
- CSU
- CSU
- CSU
- 二分法入门——POJ1064 ,POJ2456 ,POJ3111
- 构建Maven项目自动下载jar包
- Linux常用指令
- C++之静态函数详解
- pat-basic-1038-c语言
- CSU-1003
- 高中OJ3503. 【NOIP2013模拟11.4B组】粉刷(paint)
- freetype的使用
- 程序猿耍题的好去处
- struts2入门
- Python中os和shutil模块实用方法集锦
- 【Git】常用命令commit提交,push推送,merge,添加分支branch
- SAP 子模块
- HNOI2016 最小公倍数