codeforces400A - Inna and Choose Options 暴力

题意:给你12张只包含X 和O的牌,问你n*m = 12 中,每一列都是X的情况有几种: 谁把这题定为DP题信不信我砍死你。

解题思路:我愚蠢的暴力

解题代码:

  1 // File Name: 400a.cpp
  2 // Author: darkdream
  3 // Created Time: 2014年07月24日 星期四 08时48分04秒
  4
  5 #include<vector>
  6 #include<list>
  7 #include<map>
  8 #include<set>
  9 #include<deque>
 10 #include<stack>
 11 #include<bitset>
 12 #include<algorithm>
 13 #include<functional>
 14 #include<numeric>
 15 #include<utility>
 16 #include<sstream>
 17 #include<iostream>
 18 #include<iomanip>
 19 #include<cstdio>
 20 #include<cmath>
 21 #include<cstdlib>
 22 #include<cstring>
 23 #include<ctime>
 24
 25 using namespace std;
 26 char str[100];
 27 int is(int i , int j )
 28 {
 29    for(int k = i;k <= 12;k += j)
 30    {
 31       if(str[k] == ‘O‘)
 32           return 0;
 33    }
 34    return 1 ;
 35 }
 36 int main(){
 37     int n;
 38     scanf("%d",&n);
 39     for(int i =1;i<= n; i ++)
 40     {
 41         scanf("%s",&str[1]);
 42         int sum = 0 ;
 43         int ok ;
 44         ok = 0;
 45         int a[10] = {0};
 46         for(int i =1;i <= 1;i ++)
 47         {
 48            if(is(i,1))
 49                ok = 1 ;
 50         }
 51         if(ok)
 52             a[1]++ ;
 53         sum += ok ;
 54         ok = 0;
 55         for(int i =1;i <= 2;i += 1)
 56         {
 57            if(is(i,2))
 58                ok = 1 ;
 59         }
 60         if(ok)
 61             a[2]++ ;
 62         sum += ok ;
 63         ok = 0;
 64         for(int i =1;i <= 3;i +=1)
 65         {
 66            if(is(i,3))
 67                ok = 1 ;
 68         }
 69         if(ok)
 70             a[3]++ ;
 71         sum += ok ;
 72         ok = 0;
 73         for(int i =1;i <= 4;i ++)
 74         {
 75            if(is(i,4))
 76                ok = 1 ;
 77         }
 78         if(ok)
 79             a[4]++ ;
 80         sum += ok ;
 81         ok = 0;
 82         for(int i =1;i <= 6;i ++)
 83         {
 84            if(is(i,6))
 85                ok = 1 ;
 86         }
 87         if(ok)
 88             a[5]++ ;
 89         sum += ok ;
 90         ok = 0;
 91         for(int i =1;i <= 12;i ++ )
 92         {
 93            if(is(i,12))
 94                ok = 1 ;
 95         }
 96         if(ok)
 97             a[6]++ ;
 98         sum += ok ;
 99         printf("%d ",sum);
100         if(a[6])
101             printf("1x12 ");
102         if(a[5])
103             printf("2x6 ");
104         if(a[4])
105             printf("3x4 ");
106         if(a[3])
107             printf("4x3 ");
108         if(a[2])
109             printf("6x2 ");
110         if(a[1])
111             printf("12x1 ");
112         printf("\n");
113     }
114 return 0;
115 }

codeforces400A - Inna and Choose Options 暴力

时间: 2024-08-01 16:52:40

codeforces400A - Inna and Choose Options 暴力的相关文章

CodeForces 400A Inna and Choose Options

Inna and Choose Options Time Limit: 1000ms Memory Limit: 262144KB This problem will be judged on CodeForces. Original ID: 400A64-bit integer IO format: %I64d      Java class name: (Any) There always is something to choose from! And now, instead of "N

ACM--模拟--Inna and Choose Options--水

题目地址:传送门 H - Inna and Choose Options Time Limit:1000MS     Memory Limit:262144KB     64bit IO Format:%I64d & %I64u Submit Status Description There always is something to choose from! And now, instead of "Noughts and Crosses", Inna choose a v

大神刷题表

9月27日 后缀数组:[wikioi3160]最长公共子串 dp:NOIP2001统计单词个数 后缀自动机:[spoj1812]Longest Common Substring II [wikioi3160]最长公共子串 [spoj7258]Lexicographical Substring Search 扫描线+set:[poj2932]Coneology 扫描线+set+树上删边游戏:[FJOI2013]圆形游戏 结论:[bzoj3706][FJ2014集训]反色刷 最小环:[poj1734

Codeforces Round #214 (Div. 2)---C. Dima and Salad

Dima, Inna and Seryozha have gathered in a room. That's right, someone's got to go. To cheer Seryozha up and inspire him to have a walk, Inna decided to cook something. Dima and Seryozha have n fruits in the fridge. Each fruit has two parameters: the

Codeforces Round #234A

Inna and choose option     题意: 一个由12个字符('O'或'X')组成的字符串,这12个字符可以排列成a*b(a*b=12)的矩阵,要求矩阵某一列都是'X'.用户输入t个字符串,都是由12个'O'或'X组成,设计函数可求解符合要求矩阵的个数,并且将符合要求的矩阵大小输出. Input: 第一行输入一个整数t(Range:1-100),t表示要输入的测试数据的个数,下面每一行输入都是一组数据被录入. Output: 将每组数据的结果放在一行输出,format:n ax

easyui validate -- radio、checkbox 校验扩展

1.extension.js: $.extend($.fn.validatebox.defaults.rules, { radio: { validator: function(value, param){ var input = $(param[0]),status = false; input.off('.radio').on('click.radio',function(){ $(this).focus(); try{ cntObj.tooltip('hide'); }catch(e){}

LC_ALL=C的含义

在很多的shell脚本中,我们经常会看见某一句命令的前面有一句“LC_ALL=C” SAR_CMD="LC_ALL=C sar -u -b 1 5 | grep -i average " 这到底是什么意思? LC_ALL=C 是为了去除所有本地化的设置,让命令能正确执行. --------------------------------- 转帖:http://www.linuxsky.org/doc/newbie/200707/84.html 在Linux中通过locale来设置程序运

iOS Sprite Kit教程之xcode安装以及苹果帐号绑定

iOS Sprite Kit教程之xcode安装以及苹果帐号绑定 其他的站点上下载安装Xcode 有时候,应用商店下载较慢,所以用户也能够选择从其它站点下载Xcode安装文件.以下解说这样的Xcode的安装步骤: (1)双击下载的Xcode软件,弹出正在打开此软件的对话框,如图1.26所看到的. (2)打开该软件后,就会弹出Xcode对话框,如图1.27所看到的. 图1.26  操作步骤1                                     图1.27  操作步骤2 (3)将

Swift基础:创建第一个Swift工程:Swift的基本语法

苹果公司在今年的WWDC大会上,除了发布了iOS8和Max OS X 10.10之外,还发布了一个新的编程语言Swift.不得不说,Swift有较大的转变,也使编程变得更加容易了,下面介绍了Swift的常量和变量的定义,基本控制语句的使用: 需要注意的是:Swift只能在Xcode 6 Beta版中运行,Xcode 6 目前最新的是Beta 7,大家可以通过以下链接下载: http://adcdownload.apple.com//Developer_Tools/xcode_6_beta_7_a