- 博客(16)
- 收藏
- 关注
原创 hdu 1045 Fire Net
Description Suppose that we have a square city with straight streets. A map of a city is a square board with n rows and n columns, each representing a street or a piece of wall.A blockhouse is a small
2016-06-30 16:53:36 382
原创 hdu 1015 Safecracker
=== Op tech briefing, 2002/11/02 06:42 CST === “The item is locked in a Klein safe behind a painting in the second-floor library. Klein safes are extremely rare; most of them, along with Klein and his
2016-06-30 14:36:38 293
原创 poj 1321 棋盘问题
Description 在一个给定形状的棋盘(形状可能是不规则的)上面摆放棋子,棋子没有区别。要求摆放时任意的两个棋子不能放在棋盘中的同一行或者同一列,请编程求解对于给定形状和大小的棋盘,摆放k个棋子的所有可行的摆放方案C。Input 输入含有多组测试数据。 每组数据的第一行是两个正整数,n k,用一个空格隔开,表示了将在一个n*n的矩阵内描述棋盘,以及摆放棋子的数目。 n <= 8 , k
2016-06-29 22:25:05 353
原创 poj 2078 Matrix
Description Given an n*n matrix A, whose entries Ai,j are integer numbers ( 0 <= i < n, 0 <= j < n ). An operation SHIFT at row i ( 0 <= i < n ) will move the integers in the row one position right, a
2016-06-29 13:03:48 1314
原创 uva 725 - Division
Write a program that finds and displays all pairs of 5-digit numbers that between them use the digits 0 through 9 once each, such that the first number divided by the second is equal to an integer
2016-06-28 16:39:22 395
原创 csu 1751: 卡牌通行证
DescriptionA城市的宴会宾客进场都是要有对应编号的卡牌的,在A城市的各个商店中都能买到这样的卡牌,不同标号的卡牌价钱都一样为单位1,最近这段时间有n场宴会,每场宴会都有自己要求对应的卡牌编号,这些编号保证是连续,也就是说你只要有标号为[ai,bi]中的任意一张卡牌你都能进入这个宴会。小明现在很渴望参加宴会并在其中找到自己心仪的女生,所以他每场都不想错过,他现在已经知道了每场宴会对应要求的编
2016-06-26 11:39:38 586
原创 hdu 3711 Binary Number
Description For 2 non-negative integers x and y, f(x, y) is defined as the number of different bits in the binary format of x and y. For example, f(2, 3)=1,f(0, 3)=2, f(5, 10)=4. Now given 2 sets of n
2016-06-23 11:35:40 173
转载 codeforce B. Alyona and Mex
Someone gave Alyona an array containing n positive integers a1, a2, …, an. In one operation, Alyona can choose any element of the array and decrease it, i.e. replace with any positive integer that is s
2016-06-23 09:06:32 696
原创 codeforce A. Alyona and Numbers
After finishing eating her bun, Alyona came up with two integers n and m. She decided to write down two columns of integers — the first column containing integers from 1 to n and the second containing
2016-06-22 11:20:23 196
原创 hdu 1030 Delta-wave
Problem Description A triangle field is numbered with successive integers in the way shown on the picture below.The traveller needs to go from the cell with number M to the cell with number N. The tra
2016-06-21 17:23:33 470
原创 单独的数字
给定一个数组,除了一个数出现1次之外,其余数都出现3次。找出出现一次的数。如:{1, 2, 1, 2, 1, 2, 7}, 找出7.格式:第一行输入一个数n,代表数组的长度,接下来一行输入数组A[n],(输入的数组必须满足问题描述的要求),最后输出只出现一次的数。要求:你的算法只能是线性时间的复杂度,并且不能使用额外的空间哦~ 样例输入4 0 0 0 5样例输出5#include<iostrea
2016-06-19 20:37:57 441
原创 整数转换成罗马数字
给定一个整数num,( 1<=num<=3999),将整数转换成罗马数字。如1,2,3,4,5对应的罗马数字分别位I,II,III,IV,V等。格式:第一行输入一个整数,接下来输出对应的罗马数字。提示:罗马数字的常识见此链接,对做题有帮助哦~尤其是表示方法。http://baike.baidu.com/link?url=injU8M4bAoc2zRZQ1GtgrfvuzCJO9PLnq6fpQGJL
2016-06-19 16:35:34 844
原创 罗马数字转换成整数
给定一个罗马数字s,( I<=s<=MMMCMXCIX)(即1到3999),将罗马数字转换成整数。如罗马数字I,II,III,IV,V分别代表数字1, 2, 3, 4, 5。格式:第一行输入一个罗马数字,接下来输出对应的整数。提示:首先要来了解一下罗马数字表示法,基本字符有7个:I,V,X,L,C,D,M,分别表示1,5,10,50,100,500,1000。在构成数字的时候,有下列规则:1、相同的
2016-06-19 11:14:09 860
原创 XTU 1243 2016
2016Given a 2×2 matrix A=(a11a21a12a22), find An where A1=A,An=A×An−1. As the result may be large, you are going to find only the remainder after division by 7.Special Note: The problem is intended t
2016-06-17 11:32:33 782
原创 计蒜客 X的平方根
设计函数int sqrt(int x),计算x的平方根。格式:输入一个数x,输出它的平方根。直到碰到结束符号为止。 分析:2分,找到一个最为接近的数,要注意的是强制转化 1.999999转化成int 还是1;#include<iostream> #include<string> #include<cstring> #include<cstdio> #include<cmath> using na
2016-06-16 21:51:58 1390
原创 XTU 1231 人生成就
题目描述人生就像一个n*n的矩阵,矩阵每个元素都跟上下左右四个方向的元素联通,起始在左上角,终止在右下角,从起点开始,每次一个向右或向下移动一格。 每个元素上面都有一个人生成就值,表示你如果经历这个元素时候能增加的人生成就。 初始时候你的人生成就值为0,你当然想到达终点时候能获得最大的人生成就。那么问题来了:(你一定会以为我会要你求出到达终点时的最大人生成就值,但是你错了),问题就是,一共有多少
2016-06-01 22:00:05 444
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人