UC browser
来源:互联网 发布:上海网络企业排名 编辑:程序博客网 时间:2024/04/27 19:12
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
下面是代码
#include<iostream>
int main(void)
{
int a[9][2]={{0,49},{1,149},{2,249},{3,349},{4,449},{5,549},{6,649},{7,749},{8,750}};
int level;
int count;
int len;
int days,length=0,i;
char chs[101]={0};
int elememt_case;
scanf("%d",&elememt_case);
while (elememt_case--)
{
level = 0;
count = 0;
len = 1;
scanf("%d",&days);
scanf("%s",chs);
length = days;
for (i=0;i<length;i++)
{
if ((len % 6)== 0)
{
len = 1;
}
if (chs[i]=='1')
{
count += 10*(len%6);
len++;
continue;
}
len = 1;
}
for (i=0;i < 9;i++)
{
if (i == 8)
{
level = 8;
break;
}
if (count <= a[i][1])
{
level = a[i][0];
break;
}
//level++;
}
printf("%d\n",level);
}
return 0;
}#include<iostream>
int main(void)
{
int a[9][2]={{0,49},{1,149},{2,249},{3,349},{4,449},{5,549},{6,649},{7,749},{8,750}};
int level;
int count;
int len;
int days,length=0,i;
char chs[101]={0};
int elememt_case;
scanf("%d",&elememt_case);
while (elememt_case--)
{
level = 0;
count = 0;
len = 1;
scanf("%d",&days);
scanf("%s",chs);
length = days;
for (i=0;i<length;i++)
{
if ((len % 6)== 0)
{
len = 1;
}
if (chs[i]=='1')
{
count += 10*(len%6);
len++;
continue;
}
len = 1;
}
for (i=0;i < 9;i++)
{
if (i == 8)
{
level = 8;
break;
}
if (count <= a[i][1])
{
level = a[i][0];
break;
}
//level++;
}
printf("%d\n",level);
}
return 0;
}
- UC browser
- UC Browser
- UC Browser
- CSU 1003 UC Browser
- 1003: UC Browser
- CSU 1003: UC Browser
- ACM:H: UC Browser
- COJ 1003: UC Browser
- CSU-ACM 1003: UC Browser
- 隐藏比较深的模拟题1003: UC Browser
- browser
- browser
- Browser
- browser
- UC
- UC
- Google Browser, Firefox Browser?
- Free MIB Browser / MIB Browser / SNMP Browser.
- 杭电2035 人见人爱A^B
- CSS 选择器
- 感情其实我真的输不起,原来521+365=886!
- instanceof final 抽象类的理解
- Java面试--Spring技术要点--Spring IOC
- UC browser
- 《Effective Java》阅读笔记(三)
- 静态库.a的生成,及生成一个依赖另一个库存在的静态库
- Maven入门
- 《高性能MySQL》读书笔记--优化服务器设置
- 机器学习实战——SVM(2/3)
- LeetCode 210 - Course Schedule II
- ORACLE的SQL语句优化
- 浅析HashMap的实现和性能分析