UVA1585 UVALive3354 Score

Regionals 2005 >> Asia - Seoul

问题链接:UVA1585 UVALive3354 Score入门练习题,用C语言编写程序。

这个题是计算得分,得分规则有点像保龄球的得分规则,连续正确的次数越多分数越高。

程序中,程序逻辑都是套路。

AC的C语言程序如下:

/* UVA1585 UVALive3354 Score */

#include <stdio.h>

int main(void)
{
    int t, ans, count;
    char c;

    scanf("%d", &t);
    getchar();
    while(t--) {
        ans = 0;
        count = 0;
        while((c = getchar()) != '
') {
            if(c == 'O') {
                count++;
                ans += count;
            } else if(c == 'X')
                count = 0;
        }

        printf("%d
", ans);
    }

    return 0;
}


原文地址:https://www.cnblogs.com/tigerisland/p/7564527.html