2015年4月28日
摘要: http://www.patest.cn/contests/pat-b-practise/1017本题要求计算A/B,其中A是不超过1000位的正整数,B是1位正整数。你需要输出商数Q和余数R,使得A = B * Q + R成立。输入格式:输入在1行中依次给出A和B,中间以1空格分隔。输出格式:在1... 阅读全文
posted @ 2015-04-28 18:26 Asin_LZM 阅读(189) 评论(0) 推荐(0) 编辑
摘要: http://www.patest.cn/contests/pat-b-practise/1018大家应该都会玩“锤子剪刀布”的游戏:两人同时给出手势,胜负规则如图所示:现给出两人的交锋记录,请统计双方的胜、平、负次数,并且给出双方分别出什么手势的胜算最大。输入格式:输入第1行给出正整数N( 2 ... 阅读全文
posted @ 2015-04-28 18:13 Asin_LZM 阅读(203) 评论(0) 推荐(0) 编辑
摘要: http://www.patest.cn/contests/pat-b-practise/1019给定任一个各位数字不完全相同的4位正整数,如果我们先把4个数字按非递增排序,再按非递减排序,然后用第1个数字减第2个数字,将得到一个新的数字。一直重复这样做,我们很快会停在有“数字黑洞”之称的6174,... 阅读全文
posted @ 2015-04-28 17:03 Asin_LZM 阅读(206) 评论(0) 推荐(0) 编辑
摘要: http://www.patest.cn/contests/pat-b-practise/1020月饼是中国人在中秋佳节时吃的一种传统食品,不同地区有许多不同风味的月饼。现给定所有种类月饼的库存量、总售价、以及市场的最大需求量,请你计算可以获得的最大收益是多少。注意:销售时允许取出一部分库存。样例给... 阅读全文
posted @ 2015-04-28 16:39 Asin_LZM 阅读(218) 评论(0) 推荐(0) 编辑
  2015年4月27日
摘要: http://www.patest.cn/contests/pat-a-practise/1099A Binary Search Tree (BST) is recursively defined as a binary tree which has the following properties... 阅读全文
posted @ 2015-04-27 19:56 Asin_LZM 阅读(884) 评论(0) 推荐(0) 编辑
摘要: http://www.patest.cn/contests/pat-a-practise/1096Among all the factors of a positive integer N, there may exist several consecutive numbers. For examp... 阅读全文
posted @ 2015-04-27 18:17 Asin_LZM 阅读(607) 评论(0) 推荐(0) 编辑
摘要: http://www.patest.cn/contests/pat-a-practise/1097Given a singly linked list L with integer keys, you are supposed to remove the nodes with duplicated ... 阅读全文
posted @ 2015-04-27 18:13 Asin_LZM 阅读(192) 评论(0) 推荐(0) 编辑
摘要: http://www.patest.cn/contests/pat-a-practise/1098According to Wikipedia:Insertion sortiterates, consuming one input element each repetition, and growi... 阅读全文
posted @ 2015-04-27 17:04 Asin_LZM 阅读(207) 评论(0) 推荐(0) 编辑
  2015年4月21日
摘要: PAT (Basic Level) Practise (中文)- 1021. 个位数统计 (15) http://www.patest.cn/contests/pat-b-practise/1021给定一个k位整数N = dk-1*10k-1+ ... + d1*101+ d0(00),请编写程序统... 阅读全文
posted @ 2015-04-21 19:12 Asin_LZM 阅读(160) 评论(0) 推荐(0) 编辑
摘要: PAT (Basic Level) Practise (中文)- 1022. D进制的A+B (20) http://www.patest.cn/contests/pat-b-practise/1022输入两个非负10进制整数A和B( 2 3 int main() 4 { 5 //123 ... 阅读全文
posted @ 2015-04-21 19:10 Asin_LZM 阅读(191) 评论(0) 推荐(0) 编辑