codeforces round #234B(DIV2) A Inna and Choose Options

OpenSoucre發表於2014-03-08
#include <iostream>
#include <string>
#include <vector>

using namespace std;

const int num = 6;
const int item[] = {1,2,3,4,6,12};

int main(){
    int t;
    cin >>  t;
    for(int i = 0 ; i < t; ++ i ){
        string character;
        cin >>  character;
        vector<int> result;
        for(int j = 0 ;  j < num ; ++ j){
            int a = item[j], b = 12/a;
            int col = 0, row = 0;
            for(col = 0; col < b ; ++ col){
                for(row = 0 ; row < a; ++ row){
                    if(character[col+b*row] == 'O') break;
                }
                if(row >= a) break;
            }
            if(col < b) result.push_back(a);
        }
        cout<<result.size();
        for(int k = 0 ; k <  result.size(); ++ k ){
            cout<<" "<<result[k]<<"x"<<12/result[k];
        }
        cout<<endl;
    }
}

 

相關文章