• [恢]hdu 2539


    2011-12-31 19:37:25

    地址:http://acm.hdu.edu.cn/showproblem.php?pid=2539

    题意:中文。有点点麻烦的模拟。

    代码:

    # include <stdio.h>
    # include <string.h>


    char str[110] ;
    int goal[20] ;


    int judge (char s[])
    {
    int len = strlen(s) ;
    if (len < 10) return 1 ;
    if (s[len-8] == ' ' &&
    s[len-7] == 'n' &&
    s[len-6] == 'o' &&
    s[len-5] == ' ') return 2 ;
    return 1 ;
    }


    int main ()
    {
    int T, i, n, score ;
    while (~scanf ("%d%*c", &n), n)
    {
    for (i = 0 ; i < n ; i++)
    {
    gets (str) ;
    goal[i] = judge(str) ;
    }

    for (i = 1 ;i <= (n+1)/2 ; i++)
    printf ("%d ", i) ;
    printf ("Score\n") ;

    for (i = 0, score = 0 ; i < n; i+=2)
    {
    printf ("%c ", (goal[i] == 1) ? 'O' : 'X') ;
    score += (goal[i] == 1) ;
    }
    printf ("%d\n", score) ;

    for (i = 1, score = 0 ; i < n ; i+=2)
    {
    printf ("%c ", (goal[i] == 1) ? 'O' : 'X') ;
    score += (goal[i] == 1) ;
    }
    if (n &1) printf ("- ") ;
    printf ("%d\n", score) ;
    }
    return 0 ;
    }



  • 相关阅读:
    python day 09 文件操作
    day python calss08 深浅copy
    python.day05
    pytonn04day
    python开发day03
    python开发day02
    python 变量名的规范
    设备描述表
    GDI基础
    windows编程-窗口
  • 原文地址:https://www.cnblogs.com/lzsz1212/p/2315441.html
Copyright © 2020-2023  润新知