循环周期为5天,只要知道连续的天数,就可以计算出经验值。
// 1003 UC Browser
# include <stdio.h>
# define MAXN 105
short int expr[] = {0,1,3,6,10,15};
int main()
{
int T, n, tot, cnt, i;
char a[MAXN];
scanf("%d", &T);
while (T > 0)
{
scanf("%d%s", &n,a);
tot = 0;
for (i=0; i<n; ++i)
{
cnt = 0;
while ('1'==a[i]){++cnt;++i;}
tot += (cnt/5)*15+expr[cnt%5];
}
printf("%d\n",(tot<75 ? (tot+5)/10:8));
--T;
}
return 0;
}