UC browser



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

 

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

2
6
110101
12
111111110101

Sample Output

1
2

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;
}

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
功能优化 1、【HTML 5跑分】提升到259分,超越4.0固件的自带浏览器,页面解析、多媒体展现更酷更炫。 2、【智能适配】便捷贴心,自动对网址输入、关键字搜索的内容进行智能适配,你只需输入部分内容,就能显示可能用到的网址或关键字任君选择,令你的输入更便捷,四两拨千斤! 3、长按输入框选择【长文本输入】,可以边输入边预览多行文本,一个字都逃不出你的法眼!功能简易实用,已经覆盖所有页面的输入框啦~!输入大段大段文字也不怕看不到前文啦! 4、【速度优化】新体验,此版本对启动、联网、下载三大模块进行更深入的速度优化,定必给你带来更畅快的浏览体验! 5、【论坛模式UI优化】清爽配色+简洁排版,帮你自动过滤广告信息。二级页面帖子列表图标换新装,新增高亮显示,帖子分布更分明,行距比例更合理。用UC泡论坛更好、更快、更省流量。 6、支持从【网盘上传文件】借助UC网盘实现四两拨千斤,上传文件零流量有木有!2012省流量就是省钱有木有! 7、【滑屏前进后退】体验优化,左右划屏更容易响应前进后退操作啦~!亲爱的友友们试试看!!! 8、【加入导航】体验优化,操作更贴心,专注细节的优化,UC更懂你吖亲~~~! 9、【长按菜单】合理延长响应时间,这样就不容易误操作啦~!友友们赶快体验体验! 10、【性能优化】启动速度与内存占用减少10M以上,UC越来越给力了有木有!

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值