摘要: 3.判断日期是一年的第几天参数返回值解析:参数: y:int,年份; m:int,月份 d:int,日期返回值: sum:传入日期是当年的第几天;函数解析: leapyear(y);判断y是不是闰年,参考(2)闰年判断;链接地址:http://www.cnblogs.com/kongkaikai/p... 阅读全文
posted @ 2015-07-25 16:45 孔凡凯凯 阅读(353) 评论(0) 推荐(0) 编辑
摘要: 2.闰年判断参数返回值解析:参数: a:int,年份;返回值: 1:闰年; 0:非闰年; 1 int leapyear(int a) 2 3 { 4 5 if(a%400==0) 6 7 { 8 9 return 1;10 11 }12 13 ... 阅读全文
posted @ 2015-07-25 16:43 孔凡凯凯 阅读(790) 评论(0) 推荐(0) 编辑
摘要: 1、随机数函数参数返回值解析:参数: a:int,数字范围最小值; b:int,数字范围最大值;返回值: 1:闰年; 0:非闰年;备注: a-b的绝对值不能超过int的最大值(65535);头文件: time.h 、stdlib.h;#include #include #include int ra... 阅读全文
posted @ 2015-07-25 16:42 孔凡凯凯 阅读(157) 评论(0) 推荐(0) 编辑
摘要: A common pastime for poker players at a poker table is to shuffle stacks of chips. Shuffling chips is performed by starting with two stacks of poker chips, S1 and S2, each stack containing C chips. Each stack may contain chips of several different colors.The actual shuffle operation is performed by 阅读全文
posted @ 2013-08-26 19:32 孔凡凯凯 阅读(186) 评论(0) 推荐(0) 编辑
摘要: DescriptionThe ministers of the cabinet were quite upset by the message from the Chief of Security stating that they would all have to change the four-digit room numbers on their offices. — It is a matter of security to change such things every now and then, to keep the enemy in the dark. — But look 阅读全文
posted @ 2013-08-26 16:26 孔凡凯凯 阅读(197) 评论(0) 推荐(0) 编辑
摘要: DescriptionGiven a positive integer n, write a program to find out a nonzero multiple m of n whose decimal representation contains only the digits 0 and 1. You may assume that n is not greater than 200 and there is a corresponding m containing no more than 100 decimal digits.InputThe input file may 阅读全文
posted @ 2013-08-26 14:34 孔凡凯凯 阅读(221) 评论(0) 推荐(0) 编辑
摘要: Description在一个给定形状的棋盘(形状可能是不规则的)上面摆放棋子,棋子没有区别。要求摆放时任意的两个棋子不能放在棋盘中的同一行或者同一列,请编程求解对于给定形状和大小的棋盘,摆放k个棋子的所有可行的摆放方案C。Input输入含有多组测试数据。 每组数据的第一行是两个正整数,n k,用一个空格隔开,表示了将在一个n*n的矩阵内描述棋盘,以及摆放棋子的数目。 n 2 #include 3 using namespace std; 4 bool p[9][9]; 5 bool vis[9]; 6 int status; 7 int n,k; 8 void DFS(int row,int. 阅读全文
posted @ 2013-08-26 09:57 孔凡凯凯 阅读(355) 评论(0) 推荐(0) 编辑
摘要: DescriptionYou are trapped in a 3D dungeon and need to find the quickest way out! The dungeon is composed of unit cubes which may or may not be filled with rock. It takes one minute to move one unit north, south, east, west, up or down. You cannot move diagonally and the maze is surrounded by solid 阅读全文
posted @ 2013-08-26 09:39 孔凡凯凯 阅读(208) 评论(0) 推荐(0) 编辑
摘要: DescriptionA square is a 4-sided polygon whose sides have equal length and adjacent sides form 90-degree angles. It is also a polygon such that rotating about its centre by 90 degrees gives the same polygon. It is not the only polygon with the latter property, however, as a regular octagon also has 阅读全文
posted @ 2013-08-21 16:06 孔凡凯凯 阅读(301) 评论(0) 推荐(0) 编辑
摘要: DescriptionGiven m sequences, each contains n non-negative integer. Now we may select one number from each sequence to form a sequence with m integers. It's clear that we may get n ^ m this kind of sequences. Then we can calculate the sum of numbers in each sequence, and get n ^ m values. What w 阅读全文
posted @ 2013-08-21 16:02 孔凡凯凯 阅读(205) 评论(0) 推荐(0) 编辑