PAT
yerkeys
小小程序猿
展开
-
PAT 1068 Find More Coins 01背包
Eva loves to collect coins from all over the universe, including some other planets like Mars. One day she visited a universal shopping mall which could accept all kinds of coins as payments. However,...原创 2020-03-26 19:47:38 · 197 阅读 · 0 评论 -
PAT 1007最大子序列和 1045最长不下降子序列 1040最长回文子串
1007Maximum Subsequence Sumdp[i]记录以A[i]结尾的最大连续子序列和,s[i]记录该序列对应的起始位置。状态转移方程:dp[i]=max(A[i],dp[i-1]+A[i])import java.io.BufferedReader;import java.io.IOException;import java.io.InputStreamRead...原创 2020-03-25 22:02:58 · 188 阅读 · 0 评论 -
PAT 1048 Find Coins 散列/双指针
Eva loves to collect coins from all over the universe, including some other planets like Mars. One day she visited a universal shopping mall which could accept all kinds of coins as payments. However,...原创 2020-03-17 22:44:40 · 110 阅读 · 0 评论 -
PAT 1089 Insert or Merge
According to Wikipedia:Insertion sortiterates, consuming one input element each repetition, and growing a sorted output list. Each iteration, insertion sort removes one element from the input data,...原创 2020-03-17 22:09:50 · 109 阅读 · 0 评论 -
PAT A 1029 Median 双指针/二分
Given an increasing sequence S of N integers, the median is the number at the middle position. For example, the median of S1 = { 11, 12, 13, 14 } is 12, and the median of S2 = { 9, 10, 15, 16, 17 } is...原创 2020-03-17 21:03:01 · 154 阅读 · 0 评论 -
PAT A1085 Perfect Sequence / B1030 完美数列 二分/双指针
给定一个正整数数列,和正整数p,设这个数列中的最大值是M,最小值是m,如果M≤mp,则称这个数列是完美数列。现在给定参数p和一些正整数,请你从中选择尽可能多的数构成一个完美数列。输入格式:输入第一行给出两个正整数N和p,其中N(≤105)是输入的正整数的个数,p(≤109)是给定的参数。第二行给出N个正整数,每个数不超过109。输出格式:...原创 2020-03-15 23:49:07 · 162 阅读 · 0 评论 -
PAT 1033 To Fill or Not to Fill 贪心
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...原创 2020-03-14 22:41:04 · 187 阅读 · 0 评论 -
PAT 1084 Broken Keyboard 散列
On a broken keyboard, some of the keys are worn out. So when you type some sentences, the characters corresponding to those keys will not appear on screen.Now given a string that you are supposed to...原创 2020-03-13 23:33:20 · 115 阅读 · 0 评论 -
PAT 1016 Phone Bills 排序
A long-distance telephone company charges its customers by the following rules:Making a long-distance call costs a certain amount per minute, depending on the time of day when the call is made. When...原创 2020-03-13 21:20:58 · 104 阅读 · 0 评论 -
PAT 甲级 1025 PAT Ranking 排序
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 w...原创 2020-03-11 18:26:04 · 130 阅读 · 0 评论 -
PAT 甲级1012 The Best Rank 排序
To evaluate the performance of our first year CS majored students, we consider their grades of three courses only:C- C Programming Language,M- Mathematics (Calculus or Linear Algrbra), andE- Eng...原创 2020-03-13 14:20:26 · 140 阅读 · 0 评论 -
PAT 甲级 1062 Talent and Virtue 排序
About 900 years ago, a Chinese philosopher Sima Guang wrote a history book in which he talked about people's talent and virtue. According to his theory, a man being outstanding in both talent and virt...原创 2020-03-13 12:15:28 · 251 阅读 · 0 评论