题意:给定一个 n * n 的二维图像,将该图像顺时针旋转 90 度
思路:
先沿副对角线翻转一次,再沿水平中线翻转一次
复杂度:时间O(n^2),空间O(1)
void rotate(vector<vector > &matrix){
int n = matrix.size();
//沿副对角线翻转
for(int i = 0; i < n; ++i){
for(int j = 0; j < n - i; ++j){
int i2 = n - 1 - j, j2 = n - ...
分类:
其他好文 时间:
2014-08-30 16:29:09
阅读次数:
182
不涉及什么算法,只是简单的套用模板进行计算。
如果一个向量进行逆时针旋转,那么可以使用定义的函数 Rotate(v,rad)进行计算。
但是如果进行顺时针旋转,那么需要将rad改为-rad,也就是Rotate(v,-rad)进行计算。
精度的控制为 1e-10;
14112243
11178
Morley's Theorem
Accepted
C...
分类:
其他好文 时间:
2014-08-29 20:08:28
阅读次数:
282
Transform变形:可以实现文字或者图片旋转、缩放、倾斜和移动,并且该元素下的所有子元素都随着父元素一样。既然接触到transform,我们就可以做好多3d的效果啦旋转:transform:rotate(角度deg)deg是css3的“Values and Units”模块中定义的一个角度单位....
分类:
Web程序 时间:
2014-08-28 17:51:55
阅读次数:
237
In fact, the whole laser in our side still in relatively good terms with, for example, in the processing of co2 laser engraving machine a variety of m...
分类:
其他好文 时间:
2014-08-28 17:49:05
阅读次数:
287
1错误:DataXceiver error processing WRITE_BLOCK operation2014-05-06 15:21:30,378 ERROR org.apache.hadoop.hdfs.server.datanode.DataNode: hadoop-datanode1:...
分类:
其他好文 时间:
2014-08-27 18:04:08
阅读次数:
215
You are given an n x n 2D matrix representing an image.Rotate the image by 90 degrees (clockwise).Follow up:Could you do this in-place?思路:对于matrix[i][...
分类:
其他好文 时间:
2014-08-27 16:06:57
阅读次数:
179
div{transform:rotate(7deg);-ms-transform:rotate(7deg); /* IE 9 */-moz-transform:rotate(7deg); /* Firefox */-webkit-transform:rotate(7deg); /* ...
分类:
Web程序 时间:
2014-08-27 12:33:37
阅读次数:
205
An OpenFlow switch in an OpenFlow environment includes anattack determination module to collect statistical information on packet processing with resp...
分类:
移动开发 时间:
2014-08-27 00:16:26
阅读次数:
377
250分题:给定一个4位字符串initial和rotate这个字符串的方式,然后再给另一个字符串current,问current能否由initial通过rotate得到,需要几次rotate?简单的模拟题,把rotate模拟好就行。代码:TireRotation500分题:给定一个等式,求出这个等式...
分类:
其他好文 时间:
2014-08-26 13:10:56
阅读次数:
146
Given a list, rotate the list to the right by k places, where k is non-negative.For example:Given 1->2->3->4->5->NULL and k = 2,return 4->5->1->2->3->...
分类:
其他好文 时间:
2014-08-25 20:56:14
阅读次数:
206