CSU 1003 UC Browser
来源:互联网 发布:java 并发控制 编辑:程序博客网 时间:2024/09/21 08:50
1003: UC Browser
Time Limit: 1 Sec Memory Limit: 128 MBSubmit: 1386 Solved: 465
[Submit][Status][Web Board]
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:
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
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
HINT
Source
中南大学第五届大学生程序设计竞赛-热身赛
模拟题,注意浮点数转换
#include<iostream>using namespace std;char a[105];int getlevel(int sum){ int level = 8; if (sum<750) { if (sum >= 0 && sum <= 49) level = 0; if (sum >= 50 && sum <= 149) level = 1; if (sum >= 150 && sum <= 249) level = 2; if (sum >= 250 && sum <= 349) level = 3; if (sum >= 350 && sum <= 449) level = 4; if (sum >= 450 && sum <=549) level = 5; if (sum >= 550 && sum <= 649) level = 6; if (sum >= 650 && sum <= 749) level = 7; } return level;} int getscore(int i){ if (i < 5) return (i*(i+1))/2*10; else return 150 * (i / 5) + getscore(i%5);}int main(){ int T; cin >> T; while (T--) { int num, k = 1; int sum = 0; cin >> num; cin >> a; for (int i = 0; i < num; i++) if (a[i] == '1') { if (a[i + 1] == a[i]) { k++; continue; } sum += getscore(k); k = 1; } cout << getlevel(sum)<<endl; }} /************************************************************** Problem: 1003 User: 0905130123 Language: C++ Result: Accepted Time:0 ms Memory:1484 kb****************************************************************/
- CSU 1003 UC Browser
- CSU 1003: UC Browser
- CSU-ACM 1003: UC Browser
- 1003: UC Browser
- COJ 1003: UC Browser
- UC browser
- UC Browser
- UC Browser
- ACM:H: UC Browser
- 隐藏比较深的模拟题1003: UC Browser
- CSU-1003
- browser
- browser
- Browser
- browser
- CSU
- CSU
- CSU
- ClassFormatError: xxx (unrecognized class file version)
- mybatis详解
- 房屋产权=房屋所有权+土地使用权
- hdu-2795-Billboard(线段树)
- escape()、encodeURI()、encodeURIComponent()区别
- CSU 1003 UC Browser
- java中的HashCode
- 以tomcat镜像为基础部署war包后再做成镜像
- 如何利用一个数据库中间件扩展MySQL集群——kingshard使用指南
- c#获取当前年的周数,当前月的天数
- [游戏记录]滚动的天空
- mysql执行show processlist unauthenticated user 解决方法
- Erlang启动过程分析
- iptables配置FTP服务