hdu 4772
题意:给你两个矩阵,一个矩阵旋转90度,180度,270度,
然后和另外一个矩阵进行比较,如果对应值相同,则加一,最后得出最大的值
题目没什么难度。。。。主要是纪念下。。。。貌似这一题是当时比赛前一个晚上做出来的
AC代码:
#include<iostream>
#include<cstdio>
using namespace std;
int a[31][31],b[31][31];
int main()
{
int N;int i,j,m,n;
while(scanf("%d",&N)!=EOF,N)
{
int cnt[5]={0};
//cout<<1<<endl;
for( i=1;i<=N;i++)
for( j=1;j<=N;j++)
scanf("%d",&a[i][j]);
for( i=1;i<=N;i++)
for( j=1;j<=N;j++)
scanf("%d",&b[i][j]);
for(i=1;i<=N;i++)
{
for(j=1;j<=N;j++)
{
if(a[i][j]==b[i][j])
cnt[1]++;
if(a[N+1-j][i]==b[i][j])
cnt[2]++;
if(a[N+1-i][N+1-j]==b[i][j])
cnt[3]++;
if(a[j][N+1-i]==b[i][j])
cnt[4]++;
}
//cout<<-1<<endl;
}
int sum=0;
for(i=1;i<=4;i++)
{
sum=max(sum,cnt[i]);
}
printf("%d\n",sum);
}
}
hdu 4772的更多相关文章
- HDU 4772 Zhuge Liang's Password (简单模拟题)
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=4772 题面: Zhuge Liang's Password Time Limit: 2000/1000 ...
- HDU 4772 Zhuge Liang's Password (2013杭州1003题,水题)
Zhuge Liang's Password Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/O ...
- 2013 Asia Hangzhou Regional Contest
Lights Against Dudely http://acm.hdu.edu.cn/showproblem.php?pid=4770 15个位置,所以可以暴力枚举那些放,对于放的再暴力枚举哪个转, ...
- BUPT2017 wintertraining(15) #2 题解
这场有点难,QAQ.补了好久(。• ︿•̀。) ,总算能写题解了(つд⊂) A. Beautiful numbers CodeForces - 55D 题意 求\([l,r](1\le l_i\l ...
- HDOJ 2111. Saving HDU 贪心 结构体排序
Saving HDU Time Limit: 3000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others) Total ...
- 【HDU 3037】Saving Beans Lucas定理模板
http://acm.hdu.edu.cn/showproblem.php?pid=3037 Lucas定理模板. 现在才写,noip滚粗前兆QAQ #include<cstdio> #i ...
- hdu 4859 海岸线 Bestcoder Round 1
http://acm.hdu.edu.cn/showproblem.php?pid=4859 题目大意: 在一个矩形周围都是海,这个矩形中有陆地,深海和浅海.浅海是可以填成陆地的. 求最多有多少条方格 ...
- HDU 4569 Special equations(取模)
Special equations Time Limit:1000MS Memory Limit:32768KB 64bit IO Format:%I64d & %I64u S ...
- HDU 4006The kth great number(K大数 +小顶堆)
The kth great number Time Limit:1000MS Memory Limit:65768KB 64bit IO Format:%I64d & %I64 ...
随机推荐
- [转]JavaScript函数和数组总结
转自:http://www.uml.org.cn/AJAX/201307264.asp 写的不错,对我有很多帮助,最近准备全面的学习研究一下ES5,先转载一下这篇文章. JavaScript函数 1. ...
- ASP.NET程序从IIS6移植到IIS7时出现500.22错误
最可能的原因: • 此应用程序在 system.web/httpModules 节中定义配置. 可尝试的操作: • 将配置迁移到 system.webServer/modules 节 ...
- VS2013安装过程截图
================================================================ VS 2013 中新增了很多提高开发人员工作效率的新功能,比如自动补全 ...
- UVA 11389(贪心问题)
UVA 11389 Time Limit:1000MS Memory Limit:0KB 64bit IO Format:%lld & %llu Description II ...
- SPSS与聚类分析
1.进行K均值聚类分析时需要线标准化处理,抛弃量纲差异,比如说数值型变量有的以千记有的以百分数记.2.层次聚类就是先把每个样本都看成一个独立的类:聚类特征(Clustering Feature, CF ...
- 将Map转换为Java 对象
public class MapUtil { public static Object convert2Object(Class clazz,Map<String,Object[]> ma ...
- poj 3308 Paratroopers
http://poj.org/problem?id=3308 #include <cstdio> #include <cstring> #include <algorit ...
- Qt_chartdirector图形开发
ChartDirector 是一款商业的图表库,有多种语言的版本,使用它做的图表非常的精 细漂亮,提供免费版本,但会出现logo信息.网上有很多关于它的破解方法. 一.产品优点 高效快捷 采用多线程结 ...
- ASP.NET MVC 5使用CrystalReport(水晶报表)
原文:ASP.NET MVC 5使用CrystalReport(水晶报表) http://downloads.businessobjects.com/akdlm/cr4vs2010/CRforVS ...
- POJ1321 棋盘问题(dfs)
题目链接. 分析: 用 dfs 一行一行的搜索,col记录当前列是否已经放置. AC代码如下: #include <iostream> #include <cstdio> #i ...