UVa 1585 - Score

13号晚上收到学长信息才知道是做AOAPC II里的题,这道就是让统计得分的题,O得分,X不得,连着O得分多,难度不大,一次就Ac了。

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#include <stdio.h>
int main()
{
int n,i,j,count,sum;
scanf("%d\n",&n);
for(i=0;i<n;i++)
{
char a[80];
gets(a);
count=1;
sum=0;
for(j=0;j<80;j++)
{
if(a[j]=='O')
{
sum+=count;
count++;
}
else if(a[j]=='X')
count=1;
else
break;
}
printf("%d\n",sum);
}
return 0;
}

AOAPC II

** 本文迁移自我的CSDN博客,格式可能有所偏差。 **