- 博客(104)
- 收藏
- 关注
原创 PAT B1002 Python3
1002 写出这个数 (20 分)读入一个正整数 n,计算其各位数字之和,用汉语拼音写出和的每一位数字。输入格式:每个测试输入包含 1 个测试用例,即给出自然数 n 的值。这里保证 n 小于 10100。输出格式:在一行内输出 n 的各位数字之和的每一位,拼音数字间有 1 空格,但一行中最后一个拼音数字后没有空格。输入样例:1234567890987654321123456789...
2018-10-25 15:14:42 177 1
原创 PAT B1001 Python
1001 害死人不偿命的(3n+1)猜想 (15 分)卡拉兹(Callatz)猜想:对任何一个正整数 n,如果它是偶数,那么把它砍掉一半;如果它是奇数,那么把 (3n+1) 砍掉一半。这样一直反复砍下去,最后一定在某一步得到 n=1。卡拉兹在 1950 年的世界数学家大会上公布了这个猜想,传说当时耶鲁大学师生齐动员,拼命想证明这个貌似很傻很天真的命题,结果闹得学生们无心学业,一心只证 (3n+...
2018-10-25 14:43:35 148
原创 1141. PAT Ranking of Institutions (25)
PAT Ranking of Institutions (25)时间限制 500 ms 内存限制 65536 kB 代码长度限制 16000 B 判题程序 Standard 作者 CHEN, Yue After each PAT, the PAT Center will announce the ranking of institutions based on thei...
2018-03-18 21:31:53 196
原创 PAT A1140. Look-and-say Sequence (20)
Look-and-say Sequence (20)时间限制 400 ms 内存限制 65536 kB 代码长度限制 16000 B 判题程序 Standard 作者 CHEN, Yue Look-and-say sequence is a sequence of integers as the following:D, D1, D111, D113, D11231...
2018-03-18 20:54:32 959 3
原创 PAT A1126. Eulerian Path (25)
Eulerian Path (25)时间限制 300 ms 内存限制 65536 kB 代码长度限制 16000 B 判题程序 Standard 作者 CHEN, Yue In graph theory, an Eulerian path is a path in a graph which visits every edge exactly once. Similar...
2018-03-11 17:44:25 131
原创 还原二叉树:层序遍历+中序遍历
#include <iostream>#include <cstdio>#include <cstring>#include <vector>using namespace std;const int maxn = 10000;struct tree{ tree * l, *r; int data; tree...
2018-03-11 16:43:46 1277
原创 PAT A1122. Hamiltonian Cycle (25)
Hamiltonian Cycle (25)时间限制 300 ms 内存限制 65536 kB 代码长度限制 16000 B 判题程序 Standard 作者 CHEN, Yue The “Hamilton cycle problem” is to find a simple cycle that contains every vertex in a graph. Su...
2018-03-11 11:50:37 127
原创 PAT A1114. Family Property (25)
Family Property (25)时间限制 150 ms 内存限制 65536 kB 代码长度限制 16000 B 判题程序 Standard 作者 CHEN, Yue This time, you are supposed to help us collect the data for family-owned property. Given each pers...
2018-03-10 10:30:35 139
原创 PAT A1113. Integer Set Partition (25)
Integer Set Partition (25)时间限制 150 ms 内存限制 65536 kB 代码长度限制 16000 B 判题程序 Standard 作者 CHEN, Yue Given a set of N (> 1) positive integers, you are supposed to partition them into two dis...
2018-03-09 22:02:04 120
原创 PAT A1095. Cars on Campus (30)
Cars on Campus (30)时间限制 220 ms 内存限制 65536 kB 代码长度限制 16000 B 判题程序 Standard 作者 CHEN, Yue Zhejiang University has 6 campuses and a lot of gates. From each gate we can collect the in/out tim...
2018-03-09 16:03:31 157
原创 K-mean聚类应用:城市消费水平分类
import numpy as npfrom sklearn.cluster import KMeansif__name__=='__main__': data,cityName=loadData('city.txt') km=KMeans(n_clusters=3)#定义聚类中心的数目为3的KMeans方法 label=km.fit_predict(data)#调用...
2018-03-09 12:00:45 1963
原创 1080. Graduate Admission (30)
Graduate Admission (30)时间限制 200 ms 内存限制 65536 kB 代码长度限制 16000 B 判题程序 Standard 作者 CHEN, Yue It is said that in 2013, there were about 100 graduate schools ready to proceed over 40,000 app...
2018-03-08 20:26:10 97
原创 PAT A1131. Subway Map (30)
Subway Map (30)时间限制 400 ms 内存限制 65536 kB 代码长度限制 16000 B 判题程序 Standard 作者 CHEN, Yue In the big cities, the subway systems always look so complex to the visitors. To give you some sense, t...
2018-03-08 17:05:20 357
原创 PAT A1112. Stucked Keyboard (20)
Stucked Keyboard (20)时间限制 400 ms 内存限制 65536 kB 代码长度限制 16000 B 判题程序 Standard 作者 CHEN, Yue On a broken keyboard, some of the keys are always stucked. So when you type some sentences, the c...
2018-03-08 11:13:53 129
原创 PAT A1135. Is It A Red-Black Tree (30)
Is It A Red-Black Tree (30)时间限制 400 ms 内存限制 65536 kB 代码长度限制 16000 B 判题程序 Standard 作者 CHEN, Yue There is a kind of balanced binary search tree named red-black tree in the data structure. ...
2018-03-08 10:56:52 145
原创 PAT A1133. Splitting A Linked List (25)
Splitting A Linked List (25)时间限制 400 ms 内存限制 65536 kB 代码长度限制 16000 B 判题程序 Standard 作者 CHEN, Yue Given a singly linked list, you are supposed to rearrange its elements so that all the neg...
2018-03-08 09:17:06 130
原创 万妖穴
拓扑排序#include<cstdio>#include<vector>#include<queue>#include<algorithm>using namespace std;const int maxn=1002;vector<int>G[maxn];int Din[maxn]={0};int n,m;in...
2018-03-06 23:10:21 309
原创 PAT A1110. Complete Binary Tree (25)
Complete Binary Tree (25)时间限制 400 ms 内存限制 65536 kB 代码长度限制 16000 B 判题程序 Standard 作者 CHEN, Yue Given a tree, you are supposed to tell if it is a complete binary tree.Input Specification:...
2018-03-04 16:06:20 154
原创 PAT A1109. Group Photo (25)
Group Photo (25)时间限制 400 ms 内存限制 65536 kB 代码长度限制 16000 B 判题程序 Standard 作者 CHEN, Yue Formation is very important when taking a group photo. Given the rules of forming K rows with N people...
2018-03-04 15:11:33 114
原创 PAT A1108. Finding Average (20)
Finding Average (20)时间限制 400 ms 内存限制 65536 kB 代码长度限制 16000 B 判题程序 Standard 作者 CHEN, Yue The basic task is simple: given N real numbers, you are supposed to calculate their average. But w...
2018-03-04 14:33:27 90
原创 PAT A1059. Prime Factors (25)
Prime Factors (25)时间限制 100 ms 内存限制 65536 kB 代码长度限制 16000 B 判题程序 Standard 作者 HE, Qinming Given any positive integer N, you are supposed to find all of its prime factors, and write them in...
2018-03-03 20:37:27 91
原创 PAT A1058. A+B in Hogwarts (20)
A+B in Hogwarts (20)时间限制 50 ms 内存限制 65536 kB 代码长度限制 16000 B 判题程序 Standard 作者 CHEN, Yue If you are a fan of Harry Potter, you would know the world of magic has its own currency system – a...
2018-03-03 20:10:40 78
原创 PAT A1078. Hashing (25)
Hashing (25)时间限制 100 ms 内存限制 65536 kB 代码长度限制 16000 B 判题程序 Standard 作者 CHEN, Yue The task of this problem is simple: insert a sequence of distinct positive integers into a hash table, and...
2018-02-28 21:46:43 110
原创 PAT A1056. Mice and Rice (25)
Mice and Rice (25)时间限制 100 ms 内存限制 65536 kB 代码长度限制 16000 B 判题程序 Standard 作者 CHEN, Yue Mice and Rice is the name of a programming contest in which each programmer must write a piece of co...
2018-02-28 14:07:35 117
原创 PAT A1055. The World's Richest (25)
The World’s Richest (25)时间限制 400 ms 内存限制 128000 kB 代码长度限制 16000 B 判题程序 Standard 作者 CHEN, Yue Forbes magazine publishes every year its list of billionaires based on the annual ranking of ...
2018-02-28 13:12:18 93
原创 PAT A1053. Path of Equal Weight (30)
Path of Equal Weight (30)时间限制 100 ms 内存限制 65536 kB 代码长度限制 16000 B 判题程序 Standard 作者 CHEN, Yue Given a non-empty tree with root R, and with weight Wi assigned to each tree node Ti. The wei...
2018-02-28 12:38:35 96
原创 PAT A1042. Shuffling Machine (20)
Shuffling Machine (20)时间限制 400 ms 内存限制 65536 kB 代码长度限制 16000 B 判题程序 Standard 作者 CHEN, Yue Shuffling is a procedure used to randomize a deck of playing cards. Because standard shuffling t...
2018-02-27 20:19:24 89
原创 PAT A1040. Longest Symmetric String (25)
Longest Symmetric String (25)时间限制 400 ms 内存限制 65536 kB 代码长度限制 16000 B 判题程序 Standard 作者 CHEN, Yue Given a string, you are supposed to output the length of the longest symmetric sub-string...
2018-02-27 19:47:31 68
原创 PAT A1039. Course List for Student (25)
Course List for Student (25)时间限制 200 ms 内存限制 65536 kB 代码长度限制 16000 B 判题程序 Standard 作者 CHEN, Yue Zhejiang University has 40000 students and provides 2500 courses. Now given the student na...
2018-02-27 19:26:04 100
原创 PAT A1041. Be Unique (20)
Be Unique (20)时间限制 100 ms 内存限制 65536 kB 代码长度限制 16000 B 判题程序 Standard 作者 CHEN, Yue Being unique is so important to people on Mars that even their lottery is designed in a unique way. The ...
2018-02-27 18:44:39 72
原创 1034. Head of a Gang (30)
Head of a Gang (30)时间限制 100 ms 内存限制 65536 kB 代码长度限制 16000 B 判题程序 Standard 作者 CHEN, Yue One way that the police finds the head of a gang is to check people’s phone calls. If there is a ph...
2018-02-27 17:29:42 103
原创 PAT A1038. Recover the Smallest Number (30)
Recover the Smallest Number (30)时间限制 400 ms 内存限制 65536 kB 代码长度限制 16000 B 判题程序 Standard 作者 CHEN, Yue Given a collection of number segments, you are supposed to recover the smallest number...
2018-02-27 16:08:37 82
原创 PAT A1037. Magic Coupon (25)
Magic Coupon (25)时间限制 100 ms 内存限制 65536 kB 代码长度限制 16000 B 判题程序 Standard 作者 CHEN, Yue The magic shop in Mars is offering some magic coupons. Each coupon has an integer N printed on it, me...
2018-02-27 15:06:53 102
原创 PAT A1035. Password (20)
Password (20)时间限制 400 ms 内存限制 65536 kB 代码长度限制 16000 B 判题程序 Standard 作者 CHEN, Yue To prepare for PAT, the judge sometimes has to generate random passwords for the users. The problem is th...
2018-02-27 14:54:17 91
原创 PAT A1036. Boys vs Girls (25)
Boys vs Girls (25)时间限制 400 ms 内存限制 65536 kB 代码长度限制 16000 B 判题程序 Standard 作者 CHEN, Yue This time you are asked to tell the difference between the lowest grade of all the male students and...
2018-02-27 14:52:39 108
原创 PAT A1032. Sharing (25)
Sharing (25)时间限制 100 ms 内存限制 65536 kB 代码长度限制 16000 B 判题程序 Standard 作者 CHEN, Yue To store English words, one method is to use linked lists and store a word letter by letter. To save some ...
2018-02-27 13:41:06 206
原创 PAT A1031. Hello World for U (20)
Hello World for U (20)时间限制 400 ms 内存限制 65536 kB 代码长度限制 16000 B 判题程序 Standard 作者 CHEN, Yue Given any string of N (>=5) characters, you are asked to form the characters into the shape o...
2018-02-27 13:12:40 105
原创 PAT A1030. Travel Plan (30)
Travel Plan (30)时间限制 400 ms 内存限制 65536 kB 代码长度限制 16000 B 判题程序 Standard 作者 CHEN, Yue A traveler’s map gives the distances between cities along the highways, together with the cost of each...
2018-02-27 10:24:42 89
原创 PAT A1029. Median (25)
Median (25)时间限制 1000 ms 内存限制 65536 kB 代码长度限制 16000 B 判题程序 Standard 作者 CHEN, Yue Given an increasing sequence S of N integers, the median is the number at the middle position. For example...
2018-02-27 09:45:22 130
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人