STROJOPIS

Time Limit: 2000ms, Special Time Limit:5000ms,Memory Limit:65536KB
Total submit users: 21, Accepted users:19
Problem 13806 : No special judgement
Problem description
Proper typing is becoming an essential part of culture. If you are still not using all ten fingers for typing, youhave to re-learn typing ? then you will type faster and feel more comfortable and enjoyable.
There are a lot of web sites teaching proper typing. The following image depicts the basic principle; the keysneeded to press with the same finger are of the same color. The yellow keys need to be pressed with the pinky,the blue ones with the ring finger, the green ones with the middle finger and the red ones with the index finger.Naturally, the left hand presses the left side of the keyboard (starting with keys 5, T, G, B to the left), the righthand presses the right side (starting with keys 6, Y, H, N to the right). Thumbs are responsible for space.

Your task is to output how many times each finger, excluding thumbs, participated in typing the given stringproperly.
Input
The first and only line of input contains of a string consisting of at least one and at most fifty characters. Thestring doesn’t contain whitespaces and consists only of characters depicted on the image above.
Output
The output must consist of eight lines, in each line one integer denoting the number of presses of each finger,excluding thumbs, observed from left to right.
Sample Input
Sample Input 1
AON=BOO;

Sample Input 2
PRINT’NY’[NASLA]

Sample Input 3
VIDI,KO,JE,DOSA
Sample Output
Sample Output 1
1
0
0
1
1
0
3
2

Sample Output 2
2
1
0
2
4
1
1
5

Sample Output 3
1
1
3
1
1
6
2
0
Problem Source

COCI 2014/2015 contest 3


解题思路


这道题其实是一道大水题!但是有一个问题呢!那就是

这个该怎么表示啊

我好不容易弄出来一个',结果怎么会是这样呢


这个时候。。。。。请使用转义字符。。。。。。

\'



代码展示

#include<iostream>
#include<string>
using namespace std;
int main()
{
    string a;
cin>>a;
        int b[8];
        for(int i=0;i<8;i++)
        b[i]=0;
        for(int i=0;i<a.size();i++)
        {
            if(a[i]=='1'||a[i]=='Q'||a[i]=='A'||a[i]=='Z')
            b[0]++;
            if(a[i]=='2'||a[i]=='W'||a[i]=='S'||a[i]=='X')
            b[1]++;
            if(a[i]=='3'||a[i]=='E'||a[i]=='D'||a[i]=='C')
            b[2]++;
                        if(a[i]=='4'||a[i]=='R'||a[i]=='F'||a[i]=='V')
            b[3]++;
                        if(a[i]=='5'||a[i]=='T'||a[i]=='G'||a[i]=='B')
            b[3]++;
                        if(a[i]=='6'||a[i]=='Y'||a[i]=='H'||a[i]=='N')
            b[4]++;
                        if(a[i]=='7'||a[i]=='U'||a[i]=='J'||a[i]=='M')
            b[4]++;
                        if(a[i]=='8'||a[i]=='I'||a[i]=='K'||a[i]==',')
            b[5]++;
                        if(a[i]=='9'||a[i]=='O'||a[i]=='L'||a[i]=='.')
            b[6]++;
                        if(a[i]=='0'||a[i]=='P'||a[i]==';'||a[i]=='/')
            b[7]++;
                        if(a[i]=='-'||a[i]=='='||a[i]=='['||a[i]==']'||a[i]=='\'')
            b[7]++;
        }

        for(int i=0;i<8;i++)
        cout<<b[i]<<endl;
}

卡了好久这道题。。。。。另外提示一下。。。。好像这道题的output的那个单引号打错了。。。。。。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值