码迷,mamicode.com
首页 > 其他好文 > 详细

Codeforces 363A Soroban

时间:2014-07-27 11:11:42      阅读:172      评论:0      收藏:0      [点我收藏+]

标签:

算盘的模拟

#include<bits/stdc++.h>
using namespace std;
int main()
{
    char s[20];
    scanf("%s",&s);
    int len=strlen(s);
    for(int i=len-1;i>=0;i--)
    {
        if(s[i]>='5'&&s[i]<='9')
        {
            printf("-O|");
            for(int j=1;j<=s[i]-'5';j++)
                printf("O");
            printf("-");
            for(int j=1;j<='9'-s[i];j++)
                printf("O");
            printf("\n");
        }
        else
        {
            printf("O-|");
            for(int j=1;j<=s[i]-'0';j++)
                printf("O");
            printf("-");
            for(int j=1;j<='4'-s[i];j++)
                printf("O");
            printf("\n");
        }
    }
    return 0;
}


Codeforces 363A Soroban

标签:

原文地址:http://blog.csdn.net/nenuxlp/article/details/38168135

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!