循环周期为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;
}

相关文章:

  • 2021-05-12
  • 2021-06-16
  • 2021-10-25
  • 2022-12-23
  • 2021-06-02
  • 2021-12-20
  • 2021-06-03
  • 2022-02-27
猜你喜欢
  • 2021-04-29
  • 2021-09-16
  • 2021-12-08
  • 2021-12-02
  • 2021-08-11
  • 2021-04-22
相关资源
相似解决方案