Painter's ProblemTime Limit:1000MSMemory Limit:10000KTotal Submissions:4420Accepted:2143DescriptionThere is a square wall which is made of n*n small s...
分类:
其他好文 时间:
2014-07-16 22:57:42
阅读次数:
209
Arithmetic in bash is done with $ and double parentheses:echo "$(($num1+$num2))"Or $ and square brackets:echo "$[$num1+$num2]"You can assign from that...
分类:
其他好文 时间:
2014-07-11 22:33:14
阅读次数:
235
Little BishopsA bishop is a piece used in the game of chess which is played on a board of square grids. A bishop can only move diagonally from its cur...
分类:
其他好文 时间:
2014-07-09 23:05:17
阅读次数:
252
Given an integern, generate a square matrix filled with elements from 1 ton2in spiral order.For example,Givenn=3,You should return the following matri...
分类:
其他好文 时间:
2014-07-08 23:54:39
阅读次数:
407
Description
Imagine you are standing inside a two-dimensional maze composed of square cells which may or may not be filled with rock. You can move north, south, east or west one cell at a step. T...
分类:
其他好文 时间:
2014-07-08 21:04:29
阅读次数:
347
Description
Let’s play a puzzle using eight cubes placed on a 3 × 3 board leaving one empty square.
Faces of cubes are painted with three colors. As a puzzle step, you can roll one of the cubes ...
分类:
其他好文 时间:
2014-07-08 16:27:42
阅读次数:
220
Implementint sqrt(int x).Compute and return the square root ofx.public class Solution { public int sqrt(int x) { if(x < 0) return -1; if(x =...
分类:
其他好文 时间:
2014-07-06 17:37:30
阅读次数:
150
一,列表的分类1,无序列表通常使用项目符号作为列表项的前缀。符号有三种属性1,默认值为实体圆心 type="disc" 2,实体方心 type="square" 3,空心圆type="circle"语法声明这是个无序列表 并设置列表符号的样式 作为列表语句的开始2,有序列表每个列表项目前,有顺序的符...
分类:
Web程序 时间:
2014-07-06 14:31:31
阅读次数:
165
题目链接:uva 1426 - Discrete Square Roots
题目大意:给出X,N,R,求出所有满足的r,使得r2≡x%N,并且R是一个其中的解。
解题思路:
R2?r2=k?N(R?r)(R+r)=k?N=> aA=(R+r),bB=(R?r),A,B为N的因子
所以枚举A,B,就有r=R?aA=bB?RaA+bB=2?R
拓展欧几里得求解,将所有满足的解放入...
分类:
其他好文 时间:
2014-07-06 00:11:14
阅读次数:
268
UVA 1426 - Discrete Square Roots
题目链接
题意:给定X, N, R,要求r2≡x (mod n)
(1
思路:
r2≡x (mod n)=>r2+k1n=x
已知一个r!,带入两式相减得
r2?r12=kn
=> (r+r1)(r?r1)=kn
枚举A,B,使得
A * B = n
(r + r1)为A倍数
(r - r1...
分类:
其他好文 时间:
2014-07-04 07:58:36
阅读次数:
273