| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 1719 人关注过本帖
标题:微软2015校招题
只看楼主 加入收藏
rjsp
Rank: 20Rank: 20Rank: 20Rank: 20Rank: 20
等 级:版主
威 望:528
帖 子:9007
专家分:53942
注 册:2011-1-18
结帖率:91.67%
收藏
已结贴  问题点数:100 回复次数:16 
微软2015校招题
先贴原文,稍后翻译

P4 : Image Encryption
Time Limit:10000ms
Case Time Limit:1000ms
Memory Limit:256MB

Description
A fancy square image encryption algorithm works as follow:
0. consider the image as an N x N matrix
1. choose an integer k∈ {0, 1, 2, 3}
2. rotate the square image k * 90 degree clockwise
3. if N is odd stop the encryption process
4. if N is even split the image into four equal sub-squares whose length is N / 2 and encrypt them recursively starting from step 0
Apparently different choices of the k serie result in different encrypted images. Given two images A and B, your task is to find out whether it is POSSIBLE that B is encrypted from A. B is possibly encrypted from A if there is a choice of k serie that encrypt A into B.

Input
Input may contains multiple test cases.
The first line of the input contains an integer T(1 <= T <= 10) which is the number of test cases.
The first line of each testcase is an integer N, the length of the side of the images A and B.
The following N lines each contain N integers, indicating the image A.
The next following N lines each contain N integers, indicating the image B.
For 20% of the data, 1 <= n <= 15
For 100% of the data, 1 <= n <= 100, 0 <= Aij, Bij <= 100000000

Output
For each testcase output Yes or No according to whether it is possible that B is encrypted from A.

Sample Input
3
2
12
34
31
42
2
12
43
31
42
4
4123
1234
2341
3412
3441
2312
1443
2132

Sample Output
Yes
No
Yes
搜索更多相关主题的帖子: starting follow 微软 
2015-09-30 15:42
rjsp
Rank: 20Rank: 20Rank: 20Rank: 20Rank: 20
等 级:版主
威 望:528
帖 子:9007
专家分:53942
注 册:2011-1-18
收藏
得分:0 
图像加密

想象一个正方形图像加密算法的步骤如下:
0.考虑图像为 N x N 矩阵
1.选择整数 k∈ {0,1,2,3}
2.顺时针方向旋转图像 k * 90 度
3.如果 N 是奇数则停止加密过程
4.如果 N 是偶数,则将图像分割成四个相等的子正方形,从步骤0开始递归加密

显然选择不同的 k 将导致不同的结果图像。
现在,给出两个图像 A 和 B,你的任务是判断B是否可能是从A加密而来的。

输入
输入的可能包含多个测试用例。
输入的第一行包含一个整数 T (1 < = T < = 10) 这是测试用例的数量。
每个测试用例的第一行是一个整数 N,表示图像 A 和 B 的边长。
以下 N 行,每行包含 N 的整数,表示 A 图像内容
接下来以下 N 行,表示 B 图像内容
1 <= N <= 100, 0 <= Aij, Bij <= 100000000

输出
如果B有可能是A加密而来,输出Yes,否则输出No

示例输入
Sample Input
3
2
12
34
31
42
2
12
43
31
42
4
4123
1234
2341
3412
3441
2312
1443
2132

示例输出
Yes
No
Yes


[ 本帖最后由 rjsp 于 2015-9-30 15:52 编辑 ]
2015-09-30 15:50
诸葛欧阳
Rank: 19Rank: 19Rank: 19Rank: 19Rank: 19Rank: 19
来 自:流年
等 级:贵宾
威 望:82
帖 子:2790
专家分:14619
注 册:2014-10-16
收藏
得分:13 
好高级的样子

一片落叶掉进了回忆的流年。
2015-09-30 16:19
yangfrancis
Rank: 16Rank: 16Rank: 16Rank: 16
等 级:贵宾
威 望:141
帖 子:1510
专家分:7661
注 册:2014-5-19
收藏
得分:13 
输入
输入的可能包含多个测试用例。
输入的第一行包含一个整数 T (1 < = T < = 10) 这是测试用例的数量。
每个测试用例的第一行是一个整数 N,表示图像 A 和 B 的边长。
以下 N 行,每行包含 N 的整数,表示 A 图像内容
接下来以下 N 行,表示 B 图像内容
1 <= N <= 100, 0 <= Aij, Bij <= 100000000

这个好难理解
2015-10-01 23:16
yangfrancis
Rank: 16Rank: 16Rank: 16Rank: 16
等 级:贵宾
威 望:141
帖 子:1510
专家分:7661
注 册:2014-5-19
收藏
得分:0 
好像有点看懂了……
慢慢研究吧,挺有意思的,真心希望此贴不沉。
2015-10-01 23:22
h1187647735
Rank: 2
来 自:湖北huang'g
等 级:论坛游民
帖 子:26
专家分:17
注 册:2014-11-19
收藏
得分:13 
顶起

努力学习   天天向上
2015-10-04 11:45
Susake
Rank: 15Rank: 15Rank: 15Rank: 15Rank: 15
来 自:女儿国的隔壁
等 级:贵宾
威 望:23
帖 子:2288
专家分:6481
注 册:2012-12-14
收藏
得分:13 
先mark

仰望星空...........不忘初心!
2015-10-04 11:51
the_second
Rank: 2
等 级:论坛游民
帖 子:115
专家分:80
注 册:2015-9-13
收藏
得分:13 
如果图形A行数是偶数
它不断拆分,是每个正方形都要加密然后和B匹配吗
2015-10-06 11:19
yangfrancis
Rank: 16Rank: 16Rank: 16Rank: 16
等 级:贵宾
威 望:141
帖 子:1510
专家分:7661
注 册:2014-5-19
收藏
得分:0 
回复 8楼 the_second
我理解的是最初的A和最后不需再加密之后的最终结果要匹配。
2015-10-07 20:34
wangfang1
Rank: 2
等 级:论坛游民
帖 子:10
专家分:13
注 册:2015-9-29
收藏
得分:13 
学习了
2015-10-08 15:44
快速回复:微软2015校招题
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.016072 second(s), 7 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved