STROJOPIS

来源:互联网 发布:vb.net dock 顺序 编辑:程序博客网 时间:2024/06/14 22:54
Time Limit: 2000ms, Special Time Limit:5000ms,Memory Limit:65536KBTotal submit users: 21, Accepted users:19Problem 13806 : No special judgementProblem descriptionProper 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.InputThe 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.OutputThe 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 1AON=BOO;Sample Input 2PRINT’NY’[NASLA]Sample Input 3VIDI,KO,JE,DOSA
Sample Output
Sample Output 110011032Sample Output 221024115Sample Output 311311620
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的那个单引号打错了。。。。。。

原创粉丝点击