The 2015 China Collegiate Programming Contest A. Secrete Master Plan hdu5540
Secrete Master Plan
Time Limit: 3000/1000 MS (Java/Others) Memory Limit: 65535/65535 K (Java/Others)
Total Submission(s): 429 Accepted Submission(s): 244
Given two secrete master plans. The first one is the master's original plan. The second one is the plan opened by Fei. As KongMing had many pockets to hand out, he might give Fei the wrong pocket. Determine if Fei receives the right pocket.
(starting from 1) and y is either "POSSIBLE" or "IMPOSSIBLE" (quotes for clarity).
1 2
3 4
1 2
3 4
1 2
3 4
3 1
4 2
1 2
3 4
3 2
4 1
1 2
3 4
4 3
2 1
Case #2: POSSIBLE
Case #3: IMPOSSIBLE
Case #4: POSSIBLE
#include <cstdio>
#include <iostream>
using namespace std; const int N = ;
int A[][], B[][], T[][]; int main()
{
int test;
scanf("%d", &test);
for(int testnumber = ; testnumber <= test; testnumber++)
{
for(int i = ; i < ; i++)
for(int j = ; j < ; j++)
scanf("%d", &A[i][j]);
for(int i = ; i < ; i++)
for(int j = ; j < ; j++)
scanf("%d", &B[i][j]); bool flag = ;
for(int k = ; k < ; k++)
{
T[][] = B[][];
T[][] = B[][];
T[][] = B[][];
T[][] = B[][]; for(int i = ; i < ; i++)
for(int j = ; j < ; j++)
B[i][j] = T[i][j]; /*for(int i = 0; i < 2; i++)
{
for(int j = 0; j < 2; j++)
printf("%d ", B[i][j]);
printf("\n");
}*/ bool okay = ;
for(int i = ; i < && !okay; i++)
for(int j = ; j < ; j++)
if(A[i][j] != B[i][j])
{
okay = ;
break;
}
if(!okay)
{
flag = ;
break;
}
}
if(!flag) printf("Case #%d: POSSIBLE\n", testnumber);
else printf("Case #%d: IMPOSSIBLE\n", testnumber);
}
return ;
}
The 2015 China Collegiate Programming Contest A. Secrete Master Plan hdu5540的更多相关文章
- The 2015 China Collegiate Programming Contest Game Rooms
Game Rooms Time Limit: 4000/4000MS (Java/Others) Memory Limit: 65535/65535KB (Java/Others) Submi ...
- The 2015 China Collegiate Programming Contest C. The Battle of Chibi hdu 5542
The Battle of Chibi Time Limit: 6000/4000 MS (Java/Others) Memory Limit: 65535/65535 K (Java/Othe ...
- The 2015 China Collegiate Programming Contest L. Huatuo's Medicine hdu 5551
Huatuo's Medicine Time Limit: 3000/1000 MS (Java/Others) Memory Limit: 65535/65535 K (Java/Others ...
- The 2015 China Collegiate Programming Contest K Game Rooms hdu 5550
Game Rooms Time Limit: 4000/4000 MS (Java/Others) Memory Limit: 65535/65535 K (Java/Others)Total ...
- The 2015 China Collegiate Programming Contest H. Sudoku hdu 5547
Sudoku Time Limit: 3000/1000 MS (Java/Others) Memory Limit: 65535/65535 K (Java/Others)Total Subm ...
- The 2015 China Collegiate Programming Contest G. Ancient Go hdu 5546
Ancient Go Time Limit: 3000/1000 MS (Java/Others) Memory Limit: 65535/65535 K (Java/Others)Total ...
- The 2015 China Collegiate Programming Contest E. Ba Gua Zhen hdu 5544
Ba Gua Zhen Time Limit: 6000/4000 MS (Java/Others) Memory Limit: 65535/65535 K (Java/Others)Total ...
- The 2015 China Collegiate Programming Contest D.Pick The Sticks hdu 5543
Pick The Sticks Time Limit: 15000/10000 MS (Java/Others) Memory Limit: 65535/65535 K (Java/Others ...
- The 2015 China Collegiate Programming Contest -ccpc-c题-The Battle of Chibi(hdu5542)(树状数组,离散化)
当时比赛时超时了,那时没学过树状数组,也不知道啥叫离散化(貌似好像现在也不懂).百度百科--离散化,把无限空间中无限的个体映射到有限的空间中去,以此提高算法的时空效率. 这道题是dp题,离散化和树状数 ...
随机推荐
- 求sqrt()底层效率问题(二分/牛顿迭代)
偶然看见一段求根的神代码,于是就有了这篇博客: 对于求根问题,通常我们可以调用sqrt库函数,不过知其然需知其所以然,我们看一下求根的方法: 比较简单方法就是二分咯: 代码: #include< ...
- LeetCode : 287. Find the Duplicate Number
aaarticlea/png;base64,iVBORw0KGgoAAAANSUhEUgAACRAAAAMMCAYAAAAhQhmZAAAMFGlDQ1BJQ0MgUHJvZmlsZQAASImVlw ...
- 三、jQuery--Ajax基础--Ajax全接触--jQuery中的AJAX
用jQuery实现Ajax jQuery.ajax([settings]) type:类型,“POST”或“GET”,默认为“GET” url:发送请求的地址 data:是一个对象,连同请求发送到服务 ...
- mysqlbinlog 查看日志时发生报错
[root@cs Downloads]# mysqlbinlog mysql-bin. ERROR: Error , event_type: ERROR: Could not read entry a ...
- MangoDB的C#Driver驱动简单例子
以下是本人学习C#Driver驱动简单的学习例子.GridFS的增删查操作 和 表的增删查改操作. public class MongoServerHelper { public static str ...
- Ubuntu中给eclipse和android studio添加桌面快捷图标
Ubuntu 12.04 创建应用程序启动项(可在Unity LaucherPad显示) http://www.cnblogs.com/bluestorm/archive/2012/10/12/272 ...
- HTML页面实现返回顶部效果 go to top
1.首先导入jQuery插件. 2.js代码: $(window).scroll(function () { if($(window).scrollTop()>=100) { $(". ...
- Storyboards
这里是吐槽时间,换掉了mac默认的输入法,出发点只有一个,就是切换中英文输入的时候相当不爽.也许是习惯了其他各大输入法的一键切换,而又没有找到自带输入法可设置的地方. Segue 以前我们使用navi ...
- CodeIgniter类的使用
Email 类 在配置文件中设置 Email 参数 如果您不想使用使用上述方法设定参数,您可以把它们放入一个配置文件.创建一个新文件称为email.php ,添加$config数组在该文件中.然后将该 ...
- [QCon] Scrum阅读随想
最近从群里面下载到几篇文章,看到QCon出来的相关文章,觉得都写的很不错,都是一些个大公司的非常好的方法 QCon:是为团队领导者.架构师.项目经理和高级软件开发人员量身打造的企业软件开发大会,其 ...