![](https://img-blog.csdnimg.cn/20201014180756780.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
PAT
文章平均质量分 68
gemire
这个作者很懒,什么都没留下…
展开
-
PAT 1023. 组个最小数 (20)
给定数字0-9各若干个。你可以以任意顺序排列这些数字,但必须全部使用。目标是使得最后得到的数尽可能小(注意0不能做首位)。例如:给定两个0,两个1,三个5,一个8,我们得到的最小的数就是10015558。现给定数字,请编写程序输出能够组成的最小的数。输入格式:每个输入包含1个测试用例。每个测试用例在一行中给出10个非负整数,顺序表示我们拥有数字0、数字1、……数字9的个数。原创 2014-03-07 18:09:56 · 2766 阅读 · 0 评论 -
浙大2012上机 PAT 1032. Sharing (25)
To store English words, one method is to use linked lists and store a word letter by letter. To save some space, we may let the words share the same sublist if they share the same suffix. For example,原创 2014-03-22 10:09:44 · 799 阅读 · 0 评论 -
浙大2013复试:PAT 1057. Stack (30)
Stack is one of the most fundamental data structures, which is based on the principle of Last In First Out (LIFO). The basic operations include Push (inserting an element onto the top position) and Po原创 2014-03-20 20:18:16 · 3034 阅读 · 0 评论 -
浙大2012上机 PAT1034. Head of a Gang (30)
One way that the police finds the head of a gang is to check people's phone calls. If there is a phone call between A and B, we say that A and B is related. The weight of a relation is defined to be t原创 2014-03-22 13:49:33 · 1732 阅读 · 0 评论 -
浙大2012上机 PAT 1031. Hello World for U (20)
Given any string of N (>=5) characters, you are asked to form the characters into the shape of U. For example, "helloworld" can be printed as:h de ll rlowoThat is, the characters must be pr原创 2014-03-22 10:49:12 · 693 阅读 · 0 评论 -
浙大2013复试:PAT 1056. Mice and Rice (25)
Mice and Rice is the name of a programming contest in which each programmer must write a piece of code to control the movements of a mouse in a given map. The goal of each mouse is to eat as much rice原创 2014-03-19 21:41:55 · 2676 阅读 · 1 评论 -
浙大2013复试:PAT 1055 The World's Richest (25)
Forbes magazine publishes every year its list of billionaires based on the annual ranking of the world's wealthiest people. Now you are supposed to simulate this job, but concentrate only on the peopl原创 2014-03-19 20:56:06 · 1329 阅读 · 0 评论 -
PAT 1053. Path of Equal Weight (30)
Given a non-empty tree with root R, and with weight Wi assigned to each tree node Ti. The weight of a path from R to L is defined to be the sum of the weights of all the nodes along the path from R原创 2014-03-19 18:49:49 · 538 阅读 · 0 评论 -
PATA 1020 Tree Traversals (25)
Suppose that all the keys in a binary tree are distinct positive integers. Given the postorder and inorder traversal sequences, you are supposed to output the level order traversal sequence of the cor原创 2014-03-19 15:20:39 · 604 阅读 · 0 评论 -
PAT 1030 Travel Plan (30)
A traveler's map gives the distances between cities along the highways, together with the cost of each highway. Now you are supposed to write a program to help a traveler to decide the shortest path b原创 2014-03-07 11:23:05 · 1246 阅读 · 0 评论 -
PAT 1025. 反转链表 (25)
给定一个常数K以及一个单链表L,请编写程序将L中每K个结点反转。例如:给定L为1→2→3→4→5→6,K为3,则输出应该为3→2→1→6→5→4;如果K为4,则输出应该为4→3→2→1→5→6,即最后不到K个元素不反转。输入格式:每个输入包含1个测试用例。每个测试用例第1行给出第1个结点的地址、结点总个数正整数N(5)、以及正整数K(接下来有N行,每行格式为:Add原创 2014-03-08 10:21:45 · 6101 阅读 · 3 评论 -
PATA 1073. Scientific Notation (20)
Scientific notation is the way that scientists easily handle very large numbers or very small numbers. The notation matches the regular expression [+-][1-9]"."[0-9]+E[+-][0-9]+ which means that the in原创 2014-03-08 13:20:55 · 959 阅读 · 0 评论 -
PAT(Basic Level) 1022 D进制的A+B (20)
输入两个非负10进制整数A和B(30-1),输出A+B的D (1 输入格式:输入在一行中依次给出3个整数A、B和D。输出格式:输出A+B的D进制数。输入样例:123 456 8输出样例:1033注意:有一个case是0和0,如果不注意的话,这个测试点就很难过去。代码如下:#include#include#include#i原创 2014-03-07 16:41:39 · 1823 阅读 · 0 评论 -
PAT Basic Level 1024. 科学计数法 (20)
科学计数法是科学家用来表示很大或很小的数字的一种方便的方法,其满足正则表达式[+-][1-9]"."[0-9]+E[+-][0-9]+,即数字的整数部分只有1位,小数部分至少有1位,该数字及其指数部分的正负号即使对正数也必定明确给出。现以科学计数法的格式给出实数A,请编写程序按普通数字表示法输出A,并保证所有有效位都被保留。输入格式:每个输入包含1个测试用例,即一个以科学计原创 2014-03-07 20:41:42 · 1706 阅读 · 0 评论 -
PAT Basic Level 1021. 个位数统计 (15)
给定一个k位整数N = dk-1*10k-1 + ... + d1*101 + d0 (0i<=9, i=0,...,k-1, dk-1>0),请编写程序统计每种不同的个位数字出现的次数。例如:给定N = 100311,则有2个0,3个1,和1个3。输入格式:每个输入包含1个测试用例,即一个不超过1000位的正整数N。输出格式:对N中每一种不同的个位数字,以D:原创 2014-03-08 10:37:52 · 1605 阅读 · 0 评论 -
浙大2012上机 PAT 1033. To Fill or Not to Fill (25)
With highways available, driving a car from Hangzhou to any other city is easy. But since the tank capacity of a car is limited, we have to find gas stations on the way from time to time. Different ga原创 2014-03-22 09:32:53 · 789 阅读 · 0 评论