2016年11月5日 星期六

TIOJ 1181 - 氣泡.奧義

http://tioj.infor.org/problems/1181

也是普通的煩人題



 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
#include<string>
#include<iostream>
#include<cstring>
using namespace std;
int n,c,i,t;
string s;
bool app[5];
int main(){
    cin.tie(0);
    ios_base::sync_with_stdio(0);
    cin>>n;
    while(n--){
        memset(app,0,sizeof(app));
        t=0;
        for(i=0;i<12;i++){
            cin>>s;
            for(c=0;c<6;c++){
                if(s[c]=='G'){
                    app[1]=1;
                }
                else if(s[c]=='R'){
                    app[0]=1;
                }
                else if(s[c]=='B'){
                    app[2]=1;
                }
                else if(s[c]=='Y'){
                    app[3]=1;
                }
                else if(s[c]=='P'){
                    app[4]=1;
                }
            }
        }
        for(i=0;i<6;i++){
            if(app[i]) t++;
        }
        cout<<t<<'\n';
    }
}

沒有留言:

張貼留言