随笔分类 - 深搜
摘要:DescriptionGiven two positive integersnandk, you are asked to generate a new integer, saym, by changing some (maybe none) digits ofn, such that the following properties holds:mcontains no leading zeros and has the same length asn(We considerzeroitself a one-digit integer without leading zeros.)mis d
阅读全文
摘要:DescriptionN cities named with numbers 1 ... N are connected with one-way roads. Each road has two parameters associated with it : the road length and the toll that needs to be paid for the road (expressed in the number of coins).Bob and Alice used to live in the city 1. After noticing that Alice wa
阅读全文
摘要:DescriptionA network ofmroads connectsNcities (numbered from 1 toN). There may be more than one road connecting one city with another. Some of the roads are paid. There are two ways to pay for travel on a paid roadifrom cityaito citybi:in advance, in a cityci(which may or may not be the same asai);a
阅读全文
摘要:DescriptionWhen a radio station is broadcasting over a very large area, repeaters are used to retransmit the signal so that every receiver has a strong signal. However, the channels used by each repeater must be carefully chosen so that nearby repeaters do not interfere with one another. This condit
阅读全文
摘要:DescriptionSudoku is a very simple task. A square table with 9 rows and 9 columns is divided to 9 smaller squares 3x3 as shown on the Figure. In some of the cells are written decimal digits from 1 to 9. The other cells are empty. The goal is to fill the empty cells with decimal digits from 1 to 9, o
阅读全文
摘要:DescriptionYou have just been put in charge of developing a new shredder for the Shredding Company Although a "normal" shredder would just shred sheets of paper into little pieces so that the contents would become unreadable, this new shredder needs to have the following unusual basic char
阅读全文
摘要:DescriptionA university network is composed of N computers. System administrators gathered information on the traffic between nodes, and carefully divided the network into two subnetworks in order to minimize traffic between parts.A disgruntled computer science student Vasya, after being expelled fr
阅读全文
摘要:Description在一个给定形状的棋盘(形状可能是不规则的)上面摆放棋子,棋子没有区别。要求摆放时任意的两个棋子不能放在棋盘中的同一行或者同一列,请编程求解对于给定形状和大小的棋盘,摆放k个棋子的所有可行的摆放方案C。Input输入含有多组测试数据。每组数据的第一行是两个正整数,n k,用一个空格隔开,表示了将在一个n*n的矩阵内描述棋盘,以及摆放棋子的数目。 n <= 8 , k <= n当为-1 -1时表示输入结束。随后的n行描述了棋盘的形状:每行有n个字符,其中 # 表示棋盘区域, . 表示空白区域(数据保证不出现多余的空白行或者空白列)。Output对于每一组数据,给出
阅读全文
摘要:DescriptionOn Planet MM-21, after their Olympic games this year, curling is getting popular. But the rules are somewhat different from ours. The game is played on an ice game board on which a square mesh is marked. They use only a single stone. The purpose of the game is to lead the stone from the s
阅读全文
摘要:DescriptionBackgroundThe knight is getting bored of seeing the same black and white squares again and again and has decided to make a journeyaround the world. Whenever a knight moves, it is two squares in one direction and one square perpendicular to this. The world of a knight is the chessboard he
阅读全文
摘要:描述几十年前全世界就流行一种数字扑克游戏,至今仍有人乐此不疲.在中国我们把这种游戏称为“算24点”。您作为游戏者将得到4个1-13(在扑克牌里用A代替1,J代替11,Q代替12,K代替13)之间的自然数作为操作数,而您的任务是对这4个操作数进行适当的算术运算,判断运算结果是否等于24。能输出1,不能输出0。格式输入格式四个牌面值。牌面值与牌面值之间用一个空格隔开。输出格式输出0或1。样例1样例输入1[复制]3 8 10 Q样例输出1[复制]1限制每个测试点1sView Code 1 #include<iostream> 2 #include<stdio.h> 3 #in
阅读全文
摘要:1 #include<iostream> 2 using namespace std; 3 int step[21]; 4 int flag[21]; 5 int a[42]; 6 int n; 7 bool check(int x,int y) 8 { 9 if(a[x+y]&&!flag[y])10 return true;11 else12 return false;13 }14 void dfs(int dp)15 {16 int i;17 if(dp==n)18 {19 if(a[1+step[...
阅读全文
摘要:1 #include<iostream> 2 using namespace std; 3 char str[200][100]; 4 int flag[200]; 5 int t,i; 6 void dfs(char temp) 7 { 8 int j; 9 if(temp=='m')10 {11 t=1;12 return;13 }14 for(j=0;j<i;j++)15 {16 if(str[j][0]==temp&&!flag[j])17 {18 ...
阅读全文

浙公网安备 33010602011771号