![](https://img-blog.csdnimg.cn/20201014180756913.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
pat
文章平均质量分 77
小木月生
图形图像处理算法工程师,研究兴趣为虚拟现实、物理模拟等。
展开
-
用Python解决Pat上的题目,二战成功
用Python解决Pat上的题目,第一次以本地测试通过而线上评测失败告终后,心有不甘。再挑了一道更简单的题目试了一下,结果成功了。说明python确实是可以用来求解Pat上的题目呀。题目:1001. 害死人不偿命的(3n+1)猜想 (15)提交的代码如下:a = int(raw_input())count=0while(not a == 1): count+=1 if a%2==原创 2017-06-22 16:11:02 · 1511 阅读 · 0 评论 -
Python实现Pat 1041. Be Unique (20)
题目Being unique is so important to people on Mars that even their lottery is designed in a unique way. The rule of winning is simple: one bets on a number chosen from [1, 104]. The first one who bets on原创 2017-12-08 23:01:00 · 480 阅读 · 1 评论 -
Python实现Pat 1049. Counting Ones (30)
题目The task is simple: given any positive integer N, you are supposed to count the total number of 1’s in the decimal form of the integers from 1 to N. For example, given N being 12, there are five 1’s原创 2017-12-09 10:44:29 · 353 阅读 · 0 评论 -
Python实现Pat 1050. String Subtraction (20)
题目Given two strings S1 and S2, S = S1 - S2 is defined to be the remaining string after taking all the characters in S2 from S1. Your task is simply to calculate S1 - S2 for any given strings. However,原创 2017-12-09 10:57:59 · 319 阅读 · 0 评论 -
python 实现pat Sort with Swap(0,*)
题目 Sort with Swap(0,*) (25)Given any permutation of the numbers {0, 1, 2,…, N-1}, it is easy to sort them in increasing order. But what if Swap(0, *) is the ONLY operation that is allowed to use? For e原创 2017-12-01 15:44:04 · 274 阅读 · 0 评论 -
python实现pat 1071. Speech Patterns (25)
题目描述People often have a preference among synonyms of the same word. For example, some may prefer “the police”, while others may prefer “the cops”. Analyzing such patterns can help to narrow down a spea原创 2017-12-01 19:43:01 · 257 阅读 · 0 评论 -
python实现pat 1054. The Dominant Color (20)
1054. The Dominant Color (20)题目Behind the scenes in the computer’s memory, color is always talked about as a series of 24 bits of information for each pixel. In an image, the color with the largest pro原创 2017-12-04 15:56:02 · 270 阅读 · 0 评论 -
Python 实现 PAT:A+B in Hogwarts (20)
A+B in Hogwarts (20)这题比较简单,P#PYTHON 3.5AB=input().split(' ')A= [int(x) for x in AB[0].split('.')]B= [int(x) for x in AB[1].split('.')]C= [x+y for x,y in zip(A ,B)]if C[2]>=29: C[2]-=29 C[1原创 2017-11-26 18:19:35 · 306 阅读 · 0 评论 -
Python实现PAT 1063. Set Similarity (25)
1063. Set Similarity (25)Given two sets of integers, the similarity of the sets is defined to be Nc/Nt*100%, where Nc is the number of distinct common numbers shared by the two sets, and Nt is the tota原创 2017-11-27 15:05:21 · 253 阅读 · 0 评论 -
Python实现Pat 1032. Sharing (25)
pat原创 2017-12-06 14:55:08 · 344 阅读 · 0 评论 -
python实现pat 1033. To Fill or Not to Fill (25)
python实现pat 1033. To Fill or Not to Fill (25)题目传送门"""整理后的算法#1.将加油站按距离排序#2.在覆盖范围内,按优先级寻找下一个站点:比该站点价格小的最近站点;终点(或者记终点价格为0)和前者合并;比该站点价格大但范围内最小的站点#3.寻找不到下一站点,则输出最远距离#4.到达终点,输出价格以下代码写得比较粗糙,还有错误,暂时就懒得改了原创 2017-12-06 18:08:36 · 267 阅读 · 0 评论 -
Python实现Pat 1032. Sharing (25)
题目Given a collection of number segments, you are supposed to recover the smallest number from them. For example, given {32, 321, 3214, 0229, 87}, we can recover many numbers such like 32-321-3214-0229-原创 2017-12-06 21:56:11 · 303 阅读 · 0 评论 -
Python实现Pat 1085. Perfect Sequence (25)
题目Given a sequence of positive integers and another positive integer p. The sequence is said to be a “perfect sequence” if M <= m * p where M and m are the maximum and minimum numbers in the sequence,原创 2017-12-06 23:41:05 · 320 阅读 · 0 评论 -
Python实现Pat 1088. Rational Arithmetic (20)
题目For two rational numbers, your task is to implement the basic arithmetics, that is, to calculate their sum, difference, product and quotient.Input Specification:Each input file contains one test case原创 2017-12-07 11:33:18 · 202 阅读 · 0 评论 -
Python实现Pat 1003. Emergency (25)
题目As an emergency rescue team leader of a city, you are given a special map of your country. The map shows several scattered cities connected by some roads. Amount of rescue teams in each city and the原创 2017-12-07 16:12:24 · 594 阅读 · 1 评论 -
Python实现Pat 1004. Counting Leaves (30)
题目A family hierarchy is usually presented by a pedigree tree. Your job is to count those family members who have no child. InputEach input file contains one test case. Each case starts with a line con原创 2017-12-07 17:29:53 · 431 阅读 · 0 评论 -
Python实现Pat 1040. Longest Symmetric String (25)
题目Given a string, you are supposed to output the length of the longest symmetric sub-string. For example, given “Is PAT&TAP symmetric?”, the longest symmetric sub-string is “s PAT&TAP s”, hence you mus原创 2017-12-08 22:27:34 · 299 阅读 · 0 评论 -
Python实现Pat 1065. A+B and C (64bit) (20)
题目描述Given three integers A, B and C in [-263, 263), you are supposed to tell whether A+B > C.输入描述: The first line of the input gives the positive number of test cases, T (<=1000). Then T test cases f原创 2017-11-30 20:32:01 · 316 阅读 · 0 评论 -
Python实现Pat 1002. 写出这个数 (20)
读入一个自然数n,计算其各位数字之和,用汉语拼音写出和的每一位数字。输入格式:每个测试输入包含1个测试用例,即给出自然数n的值。这里保证n小于10100。输出格式:在一行内输出n的各位数字之和的每一位,拼音数字间有1 空格,但一行中最后一个拼音数字后没有空格。输入样例: 1234567890987654321123456789 输出样例: yi san wua = int(raw_input(原创 2017-06-22 16:30:39 · 670 阅读 · 0 评论 -
用Python写Pat上的题目,初战落败(问题已解决)
试着用python写PAT上题目,但遇上了个问题。本地测试正常,提交代码,结果返回为零,得分为零。网上查了一下,也没找到解决办法。题目 1001. A+B Format (20)Calculate a + b and output the sum in standard format – that is, the digits must be separated into groups of thr原创 2017-06-21 21:24:49 · 2999 阅读 · 2 评论 -
1001. A+B Format (20)
题目 1001. A+B Format (20)Calculate a + b and output the sum in standard format – that is, the digits must be separated into groups of three by commas (unless there are less than four digits).InputEach i原创 2017-06-23 11:21:45 · 271 阅读 · 0 评论 -
1002. A+B for Polynomials (25)
1002. A+B for Polynomials (25)时间限制400 ms内存限制65536 kB代码长度限制16000 B判题程序Standard作者CHEN, YueThis time, you are supposed to find A+原创 2017-06-22 16:49:42 · 194 阅读 · 0 评论 -
Python 实现Pat 1005. Spell It Right (20)
1005. Spell It Right (20)Given a non-negative integer N, your task is to compute the sum of all the digits of N, and output every digit of the sum in English.Input Specification:Each input file contain原创 2017-06-24 21:29:55 · 452 阅读 · 0 评论 -
Python实现Pat 1006. Sign In and Sign Out (25)
Pat 1006. Sign In and Sign Out (25)At the beginning of every day, the first person who signs in the computer room will unlock the door, and the last one who signs out will lock the door. Given the reco原创 2017-06-24 23:04:16 · 463 阅读 · 0 评论 -
Python 实现1007. Maximum Subsequence Sum (25)
1007. Maximum Subsequence Sum (25)Given a sequence of K integers { N1, N2, …, NK }. A continuous subsequence is defined to be { Ni, Ni+1, …, Nj } where 1 <= i <= j <= K. The Maximum Subsequence is the原创 2017-06-25 23:14:56 · 390 阅读 · 0 评论 -
Python实现Pat 1078. Hashing (25)
Pat 1078. Hashing (25)The task of this problem is simple: insert a sequence of distinct positive integers into a hash table, and output the positions of the input numbers. The hash function is defined原创 2017-11-20 21:35:14 · 421 阅读 · 0 评论 -
Python实现Pat 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 co原创 2017-12-08 11:56:11 · 346 阅读 · 0 评论 -
Python实现Pat 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 di原创 2017-12-08 14:39:22 · 238 阅读 · 0 评论 -
Python实现Pat 1028. List Sorting (25)
题目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原创 2017-12-08 15:18:34 · 371 阅读 · 0 评论 -
Python实现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原创 2017-12-08 17:52:08 · 411 阅读 · 0 评论 -
Python实现Pat 1034. 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原创 2017-12-08 21:05:15 · 376 阅读 · 0 评论 -
Python实现Pat 1035. Password (20)
题目To prepare for PAT, the judge sometimes has to generate random passwords for the users. The problem is that there are always some confusing passwords since it is hard to distinguish 1 (one) from l (L原创 2017-12-08 21:51:50 · 259 阅读 · 0 评论 -
Python实现Pat 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 ne原创 2017-12-07 20:45:04 · 406 阅读 · 0 评论