-
Pat 甲级 训练真题集 1030!
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 between his/her starting ...…
-
Pat 甲级 训练真题集 1029!
1029. Median (25) 时间限制 1000 ms 内存限制 65536 kB 代码长度限制 16000 B 判题程序 Standard 作者 CHEN, YueGiven an increasing sequence S of N integers, the median is the number at the middle position. For example, the ...…
-
Pat 甲级 训练真题集 1028!
1028. List Sorting (25)Excel can sort records according to any column. Now you are supposed to imitate this function.InputEach input file contains one test case. For each case, the first line contains two integers N (<=100000) and C, where N ...…
-
Pat 甲级 训练真题集 1027!
1027. Colors in Mars (20)People in Mars represent the colors in their computers in a similar way as the Earth people. That is, a color is represented by a 6-digit number, where the first 2 digits are for Red, the middle 2 digits for Green, and th...…
-
Pat 甲级 训练真题集 1025!
1025. PAT Ranking (25)Programming Ability Test (PAT) is organized by the College of Computer Science and Technology of Zhejiang University. Each test is supposed to run simultaneously in several places, and the ranklists will be merged immediatel...…
-
Pat 甲级 训练真题集 1021!
1023. Have Fun with Numbers (20)Notice that the number 123456789 is a 9-digit number consisting exactly the numbers from 1 to 9, with no duplication. Double it we will obtain 246913578, which happens to be another 9-digit number consisting exactl...…
-
Pat 甲级 训练真题集 1021!
1021. Deepest Root (25)A graph which is connected and acyclic can be considered a tree. The height of the tree depends on the selected root. Now you are supposed to find the root that results in a highest tree. Such a root is called the deepest...…
-
Pat 甲级 训练真题集 1019!
1019. General Palindromic Number (20)A number that will be the same when it is written forwards or backwards is known as a Palindromic Number. For example, 1234321 is a palindromic number. All single digit numbers are palindromic numbers.Althoug...…
-
Pat 甲级 训练真题集 1020!
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 corresponding binary tr...…
-
Pat 甲级 训练真题集 1017!
1017. Queueing at Bank (25)Suppose a bank has K windows open for service. There is a yellow line in front of the windows which devides the waiting area into two parts. All the customers have to wait in line behind the yellow line, until it is hi...…
-
Pat 甲级 训练真题集 1015!
1015. Reversible Primes (20) 时间限制 400 ms 内存限制 65536 kB 代码长度限制 16000 B 判题程序 Standard 作者 CHEN, YueA reversible prime in any number system is a prime whose “reverse” in that number system is also a prim...…
-
Pat 甲级 训练真题集 1013!
1013. Battle Over Cities (25)It is vitally important to have all the cities connected by highways in a war. If a city is occupied by the enemy, all the highways from/toward that city are closed. We must know immediately if we need to repair any ...…
-
Pat 甲级 训练真题集 1011&1012!
1011. World Cup Betting (20) 时间限制 400 ms 内存限制 65536 kB 代码长度限制 16000 B 判题程序 Standard 作者 CHEN, YueWith the 2010 FIFA World Cup running, football fans the world over were becoming increasingly excited a...…
-
Pat 甲级 训练真题集 1009&1010!
1009. Product of Polynomials (25)This time, you are supposed to find A*B where A and B are two polynomials.Input Specification:Each input file contains one test case. Each case occupies 2 lines, and each line contains the information of a polynomi...…
-
Pat 甲级 训练真题集 1004&1005&1006&1007&1008!
1004. Counting Leaves (30)InputEach input file contains one test case. Each case starts with a line containing 0 < N < 100, the number of nodes in a tree, and M (< N), the number of non-leaf nodes. Then M lines follow, each in the format...…
-
Pat 甲级 训练真题集 1003!
1003. Emergency (25)题目大意为有N个城市,有M条道路,C1为你正在的城市,C2为你必须救的城市输出从C1到C2共有多少条不同的最短路径和从C1到C2共能聚集多少救援队这一题我想到了利用最短路径DijastraInputEach input file contains one test case. For each test case, the first line contains 4 positive integers: N (<= 500) - the num...…
-
Pat 甲级 训练真题集 1001-1002!
string和数值之间的转换(均为C++11)to_string(val) //可将任何算术类型转为数值val的string表示stoi(s,p,b) /*返回s的起始子串(表示整数内容)的数值,b表示转换所用的 基数,默认值为10;p是size_t指针,用来保存s中第一个非数值 字符的下标,默认为0,即不保存下标 每个类型都有相应的 to_string版本...…
-
顺序容器类型所有顺序容器都提供了快速顺序访问元素的能力vector //可变大小数组,支持快速随机访问。但在尾部之外的位置插入 //或删除元素可能会很慢deque //双端队列,支持快速随机访问,在头尾位置插入/删除速度很快list //双向链表,只支持双向顺序访问。在任何位置进行插入/删除速 //度都很快forward_listarraystri...…
-
今天是关于学习C++的标准库的相关内容STRING#include<iostream>#include<string>using namespace std;int main(){ string s; cin>>s; //当有字符出现后遇空白(空格符,换行符,制表符)便终止 //如输入”sdjajsd 1321weia“ 输入的结果将只会为sdjajsd cout<<s<<endl; return 0;}s...…
-
Welcome to Grimxiaojun's Blog!
欢迎来到王小俊的个人博客这是我在github上的第一篇博客,这一篇博客我将讲述我怎么想来到github上写自己的博客的和如何在github上搭建个人博客的过程 首先我之前写博客是在CSDN上写,在途中感觉CSDN支持的Markdown简直是太low了,他的中英文切换时竟然自动直接切到了最下面一行,这是最不能忍受的,当我打着字切换了一下中英文输入法,变到了最下面一行,试问一个想成为一个好的程序员的我怎么能继续这样呢。。。不过也有可能是我没发现他的解决方法,不喜勿喷 其...…