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



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

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