http://codeforces.com/contest/426/problem/B
1 second
256 megabytes
standard input
standard output
Let's assume that we are given a matrix b of size x × y, let's determine the operation of mirroring matrix b. The mirroring of matrix b is a 2x × y matrix c which has the following properties:
- the upper half of matrix c (rows with numbers from 1 to x) exactly matches b;
- the lower half of matrix c (rows with numbers from x + 1 to 2x) is symmetric to the upper one; the symmetry line is the line that separates two halves (the line that goes in the middle, between rows x and x + 1).
Sereja has an n × m matrix a. He wants to find such matrix b, that it can be transformed into matrix a, if we'll perform on itseveral (possibly zero) mirrorings. What minimum number of rows can such matrix contain?
The first line contains two integers, n and m (1 ≤ n, m ≤ 100). Each of the next n lines contains m integers — the elements of matrix a. The i-th line contains integers ai1, ai2, ..., aim (0 ≤ aij ≤ 1) — the i-th row of the matrix a.
In the single line, print the answer to the problem — the minimum number of rows of matrix b.
4 3
0 0 1
1 1 0
1 1 0
0 0 1
2
3 3
0 0 0
0 0 0
0 0 0
3
8 1
0
1
1
0
0
1
1
0
2
In the first test sample the answer is a 2 × 3 matrix b:
001
110
If we perform a mirroring operation with this matrix, we get the matrix a that is given in the input:
001
110
110
001 。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。
、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、
题意就是问你给定一个矩阵,求它的最小对称单元
#include<iostream>
#include<cstdio>
#include<cmath>
#include<cstdlib>
#include <algorithm>
#include<cstring>
#include<string>
using namespace std; int a[][], b[][], c[][];
int main()
{
int n, m, i, j, line, temp = ;
scanf("%d%d", &n, &m);
for (i = ; i < n; i++)
{
for (j = ; j < m; j++)
{
scanf("%d", &a[i][j]);
}
}
line = n;
while (!(line % ))
{
for (i = ; i < line / ; i++)
{
for (j = ; j < m; j++)
{
if (a[i][j] != a[line - - i][j])
{
temp++;
}
}
}
if (temp)
{
break;
}
else
{
line /= ;
}
}
printf("%d\n", line);
return ;
}
Codeforces Round #243 (Div. 2) B(思维模拟题)的更多相关文章
-
Codeforces Round #609 (Div. 2)前五题题解
Codeforces Round #609 (Div. 2)前五题题解 补题补题…… C题写挂了好几个次,最后一题看了好久题解才懂……我太迟钝了…… 然后因为longlong调了半个小时…… A.Eq ...
-
Codeforces Round #243 (Div. 1) A题
http://codeforces.com/contest/425/problem/A 题目链接: 然后拿出这道题目是很多人不会分析题目,被题目吓坏了,其中包括我自己,想出复杂度,一下就出了啊!真是弱 ...
-
Codeforces Round #243 (Div. 2) C. Sereja and Swaps(优先队列 暴力)
题目 题意:求任意连续序列的最大值,这个连续序列可以和其他的 值交换k次,求最大值 思路:暴力枚举所有的连续序列.没做对是因为 首先没有认真读题,没看清交换,然后,以为是dp或者贪心 用了一下贪心,各 ...
-
Codeforces Round #243 (Div. 2) A~C
题目链接 A. Sereja and Mugs time limit per test:1 secondmemory limit per test:256 megabytesinput:standar ...
-
Codeforces Round #310 (Div. 2)--A(简单题)
http://codeforces.com/problemset/problem/556/A 题意:给一个01字符串,把所有相邻的0和1去掉,问还剩下几个0和1. 题解:统计所有的0有多少个,1有多少 ...
-
Codeforces Round #243 (Div. 2) Problem B - Sereja and Mirroring 解读
http://codeforces.com/contest/426/problem/B 对称标题的意思大概是.应当指出的,当线数为奇数时,答案是线路本身的数 #include<iostream& ...
-
Codeforces Round #243 (Div. 1)-A,B,C-D
此CF真是可笑.. . 由于早晨7初始点,因此,要做好CF时间已经17没有休息一小时,加上中午5小时耐力赛. 心里很清楚.是第一个问题的时候,几乎被解读为寻求最大的领域和.然后找到一个水体,快速A降. ...
-
Codeforces Round #416 (Div. 2)(A,思维题,暴力,B,思维题,暴力)
A. Vladik and Courtesy time limit per test:2 seconds memory limit per test:256 megabytes input:stand ...
-
Codeforces Round #336 (Div. 2)-608A.水题 608B.前缀和
A题和B题... A. Saitama Destroys Hotel time limit per test 1 second memory limit per test 256 megabyte ...
随机推荐
-
AC自动机及trie图 pascal
; type data=record sum,failed:longint; son:array ['a'..'z'] of longint; end; ..maxn] of data; que:.. ...
-
mysql中in和exists二者的区别和性能影响
mysql查询语句in和exists二者的区别和性能影响 还记得一次面试中被人问到in 和 exists的区别,当然只是草草做答,现在来做下分析. mysql中的in语句是把外表和内表作hash 连接 ...
-
about家庭智能设备部分硬件模块功能共享【协同工作】solution
本人设备列表: Onda tablet {Android} wifi Desktop computer {win7.centos7} 外接蓝牙adapter PS interface 键盘.鼠标{与同 ...
-
序列变换(Lis变形)
序列变换 Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others) Total Submi ...
-
ubuntu gnome vnc
1,安装登陆管理器 --apt-get install gdm (还可以为kdm/xdm) lightdm,display manager
-
Java集合基本概念及元素添加
Java容器类类库的用途是"保存对象", 并将其划分为两个不同的概念: (1)Collection: 一个独立元素的序列, 这些元素都服从一条或多条规则. List必须按照插入的顺 ...
-
MinerDB.java 数据库工具类
MinerDB.java 数据库工具类 package com.iteye.injavawetrust.miner; import java.sql.Connection; import java.s ...
-
mssql sqlserver SQL 位运算举例权限应用
摘要: 下文通过举例的方式讲述sqlserver中位运算的相关知识,如下所示: 实验环境:sqlserver 2008 R2 在sqlserver的权限设置,我们通常使用1.2.4.8.16.32.6 ...
-
Windows文件系统
微软在Dos/Windows系列操作系统*使用了6种不同的文件系统(包括即将在windows的下一个版本中使用的Winfs).它们分别是:FAt12.FAT16.FAT32.NTFS.NTFS5.0 ...
-
[Luogu4986] 逃离
Description 给定次数为 \(n\) 的函数 \(A(x),B(x),C(x)\),求 \(A^2(x)+B^2(x)-C^2(x)\) 在 \([L,R]\) 的零点.\(n\leq 10 ...