Inna and Choose Options

Time Limit: 1000ms
Memory Limit: 262144KB

This problem will be judged on CodeForces. Original ID: 400A
64-bit integer IO format: %I64d      Java class name: (Any)

 
There always is something to choose from! And now, instead of "Noughts and Crosses", Inna choose a very unusual upgrade of this game. The rules of the game are given below:

There is one person playing the game. Before the beginning of the game he puts 12 cards in a row on the table. Each card contains a character: "X" or "O". Then the player chooses two positive integers a and b (a·b = 12), after that he makes a table of size a × b from the cards he put on the table as follows: the first b cards form the first row of the table, the second b cards form the second row of the table and so on, the last b cards form the last (number a) row of the table. The player wins if some column of the table contain characters "X" on all cards. Otherwise, the player loses.

Inna has already put 12 cards on the table in a row. But unfortunately, she doesn't know what numbers a and b to choose. Help her win the game: print to her all the possible ways of numbers a, b that she can choose and win.

 

Input

The first line of the input contains integer t (1 ≤ t ≤ 100). This value shows the number of sets of test data in the input. Next follows the description of each of the t tests on a separate line.

The description of each test is a string consisting of 12 characters, each character is either "X", or "O". The i-th character of the string shows the character that is written on the i-th card from the start.

 

Output

For each test, print the answer to the test on a single line. The first number in the line must represent the number of distinct ways to choose the pair a, b. Next, print on this line the pairs in the format axb. Print the pairs in the order of increasing first parameter (a). Separate the pairs in the line by whitespaces.

 

Sample Input

Input
4
OXXXOXOOXOOX
OXOXOXOXOXOX
XXXXXXXXXXXX
OOOOOOOOOOOO
Output
3 1x12 2x6 4x3
4 1x12 2x6 3x4 6x2
6 1x12 2x6 3x4 4x3 6x2 12x1
0

Source

 
解题:直接乱来
 
 #include <bits/stdc++.h>
using namespace std;
char str[];
int n,d[] = {,,,,,};
vector<int>ans;
int main(){
scanf("%d",&n);
while(n--){
scanf("%s",str);
ans.clear();
for(int i = ; i < ; ++i){
for(int j = ; j < /d[i]; ++j){
bool flag = true;
for(int k = ; k < d[i]; ++k)
if(str[k*/d[i] + j] != 'X') {
flag = false;
break;
}
if(flag) {ans.push_back(d[i]);break;}
}
}
printf("%d",ans.size());
for(int i = ; i < ans.size(); ++i)
printf(" %dx%d",ans[i],/ans[i]);
putchar('\n');
}
return ;
}

CodeForces 400A Inna and Choose Options的更多相关文章

  1. Codeforces Round #234 (Div. 2) :A. Inna and Choose Options

    A. Inna and Choose Options time limit per test 1 second memory limit per test 256 megabytes input st ...

  2. Codeforces Round #234 (Div. 2) A. Inna and Choose Options 模拟题

    A. Inna and Choose Options time limit per test 1 second memory limit per test 256 megabytes input st ...

  3. Codeforces Round #234 (Div. 2) A. Inna and Choose Options

    A. Inna and Choose Options time limit per test 1 second memory limit per test 256 megabytes input st ...

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

    #include <iostream> #include <string> #include <vector> using namespace std; ; ,,, ...

  5. Codeforces--400A--Inna and Choose Options(模拟水题)

    Inna and Choose Options Crawling in process... Crawling failed Time Limit:1000MS     Memory Limit:26 ...

  6. Codeforces I. Inna and Nine(组合)

    题目描述: Inna and Nine time limit per test 1 second memory limit per test 256 megabytes input standard ...

  7. codeforces 374A Inna and Pink Pony 解题报告

    题目链接:http://codeforces.com/problemset/problem/374/A 题目意思:给出一个 n 行  m 列 的棋盘,要将放置在坐标点为(i, j)的 candy 移动 ...

  8. Codeforces 374A - Inna and Pink Pony

    原题地址:http://codeforces.com/contest/374/problem/A 好久没写题目总结了,最近状态十分不好,无论是写程序还是写作业还是精神面貌……NOIP挂了之后总觉得缺乏 ...

  9. codeforces 499A.Inna and Pink Pony 解题报告

    题目链接:http://codeforces.com/problemset/problem/499/A 题目意思:有两种按钮:1.如果当前观看的时间是 t,player 可以自动处理下一分钟,姑且理解 ...

随机推荐

  1. 自定义pulltoRefresh的刷新和加载动画

    一:定义刷新动画的layout 共同的设置方法是 1:getDefaultDrawableResId() 2:refreshingImpl() 正在刷新时的回调方法,可以设置开始动画 3:resetI ...

  2. RelativeLayout.addRule()方法

    RelativeLayout.addRule()方法 通过LayoutParams的 addRule方法来额外的添加别的规则了,android.widget.RelativeLayout.Layout ...

  3. linux 删除命令注意事项(大神勿看)

    在做软连接的时候,想到一个问题,如果删除软连接,会不会删除源文件. 如果删除是真删除的话,一旦操作错误那就后悔去吧. 效果是这样的:#rm -rf pp/          如果pp是软连文件夹,那么 ...

  4. PL SQL Developer使用总结

    如果OS为windows 7 64位系统,Oracle版本为 Oracle 11g 64 安装PL SQL Developer 请参考    http://myskynet.blog.51cto.co ...

  5. Springboot错误问题总结

    进行springboot+swagger2测试的时候,启动项目发现出现这个问题 把所有的类,配置类都注释掉,不管用,百度搜索之后发现一个解决办法, 半信半疑的加到启动类SpringBootApplic ...

  6. 开源 PHP 项目找队友、顾问、指导、贡献者等等

    介绍站点还没做,先直接甩代码链接了 https://github.com/litphp/litphp Lit是什么? Lit是我一直在撸的个人框架,按第一次上传代码来说历史 超过4年 了,从还能支持P ...

  7. Go语言的前景分析

    本文为原创文章,转载注明出处,asdfasdfasdf 欢迎扫码关注公众号flysnow_org或者网站http://www.flysnow.org/,第一时间看后续精彩文章.觉得好的话,顺手分享到朋 ...

  8. 紫书 例题8-19 UVa 12265 (扫描法+单调栈)

    首先可以用扫描法处理出一个height数组, 来保存从当前行开始, 每一个格子可以向上延伸的最大长度. 这种"延伸"的问题用扫描法, 因为往往这个时候可以利用前一次的结果来更新当前 ...

  9. Docker学习总结(8)——利用Docker开启持续交付之路

    持续交付即Continuous Delivery,简称CD,随着DevOps的流行正越来越被传统企业所重视.持续交付讲求以短周期.小细粒度,自动化的方式频繁的交付软件,在这个过 程中要求开发.测试.用 ...

  10. 2015 Multi-University Training Contest 4 hdu 5336 XYZ and Drops

    XYZ and Drops Time Limit: 3000/1500 MS (Java/Others)    Memory Limit: 65536/65536 K (Java/Others)Tot ...