Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /// https://trello.com/c/iPvrzUgB/9-problem-a-codeforces
- /// http://codeforces.com/contest/400/problem/A
- #include <iostream>
- #include <vector>
- using namespace std;
- int main()
- {
- int t;
- cin>>t;
- vector< vector<int> > resp(t);
- int v[6] = {1, 2, 3, 4, 6, 12};
- string s;
- for (int q=0; q<t; q++)
- {
- cin>>s;
- for (int p=0; p<6; p++)
- {
- int alto = v[p];
- int ancho = v[5-p];
- bool hay_col = false;
- for(int i=0; i<ancho && !hay_col; i++) ///analizo todas las columnas, mientras no halla encontrado alguna valida
- {
- bool col_valid = true;
- for(int j=0; j<alto; j++)
- if (s[ ancho*j+i ]=='O')
- col_valid = false;
- if (col_valid) /// la columna a analizar el valida hasta que se demuestre lo contrario
- hay_col = true;
- }
- if (hay_col)
- resp[q].push_back( alto );
- }
- }
- for (int q=0; q<t; q++)
- {
- cout<<resp[q].size();
- for (int i=0; i<resp[q].size(); i++)
- cout<<" "<<resp[q][i]<<"x"<<12/resp[q][i];
- cout<<endl;
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement