
PAT
文章平均质量分 67
iteye_7173
这个作者很懒,什么都没留下…
展开
专栏收录文章
- 默认排序
- 最新发布
- 最早发布
- 最多阅读
- 最少阅读
-
PAT1001 A+B Format
在一行中输入整数 a 和 b,用空格隔开( -1000000 <= a, b <= 1000000 ) 输出a+b的值,用千分位格式输出 Sample Input-1000000 9Sample Output-999,991 python版本代码如下 import re import sys def fun(num): if num ...原创 2012-11-17 23:36:17 · 113 阅读 · 0 评论 -
PAT1023 Have Fun with Numbers
大数的相加 比较两个字符串中字符完全相同 Sample Input: 1234567899 Sample Output: Yes 2469135798 #include <iostream> #include <string> #include <vector> #include <io...原创 2012-11-21 23:55:21 · 107 阅读 · 0 评论 -
PAT1025 PAT Ranking
Sample Input: 2 5 1234567890001 95 1234567890005 100 1234567890003 95 1234567890002 77 1234567890004 85 4 1234567890013 65 1234567890011 25 1234567890014 100 1234567890012 85 Sample Ou...原创 2012-11-22 23:51:45 · 134 阅读 · 0 评论 -
PAT1027 Colors in Mars
Sample Input 15 43 71 Sample Output #123456 #include <iostream> #include <iomanip> #include <string> using namespace std; void convert(int a) { ...原创 2012-11-22 23:52:28 · 102 阅读 · 0 评论 -
PAT1028 List Sorting
用vector最后一个用例超时了。。。 Sample Input 1 3 1 000007 James 85 000010 Amy 90 000001 Zoe 60 Sample Output 1 000001 Zoe 60 000007 James 85 000010 Amy 90 Sample Input 2 4 2 000007 James ...原创 2012-11-22 23:53:05 · 112 阅读 · 0 评论 -
PAT1029 Median
用标准库的排序全部超时,需要自己实现,另外还不能用cin cout Sample Input 4 11 12 13 14 5 9 10 15 16 17 Sample Output 13 #include <stdio.h> int N1[1000000]; int N2[1000000]; i...原创 2012-11-22 23:54:04 · 111 阅读 · 0 评论 -
PAT1031 Hello World for U
Sample Input: helloworld! Sample Output: h ! e d l l lowor #include <iostream> #include <iomanip> #include <string> using namespace std; ...原创 2012-11-22 23:54:37 · 155 阅读 · 0 评论 -
PAT1035 Password
Sample Input 1: 3 Team000002 Rlsp0dfa Team000003 perfectpwd Team000001 R1spOdfa Sample Output 1: 2 Team000002 RLsp%dfa Team000001 R@spodfa Sample Input 2: 1 team110 abcdefg332 Sam...原创 2012-11-23 23:40:29 · 120 阅读 · 0 评论 -
PAT1036 Boys vs Girls
Sample Input 1: 3 Joe M Math990112 89 Mike M CS991301 100 Mary F EE990830 95 Sample Output 1: Mary EE990830 Joe Math990112 6 Sample Input 2: 1 Jean M AA980920 60 Sample Output 2: ...原创 2012-11-23 23:41:07 · 167 阅读 · 0 评论 -
PAT1040 Longest Symmetric String
求最长回文子串 #include <iostream> #include <string> #include <iomanip> using namespace std; int main() { string a; getline(cin,a); int max = 0; int len...原创 2012-11-23 23:41:54 · 95 阅读 · 0 评论 -
PAT1042 Shuffling Machine
扑克洗牌 #include <iostream> #include <string> #include <vector> #include <iomanip> #include <map> #include <algorithm> using namespace std; void ...原创 2012-11-23 23:42:33 · 180 阅读 · 0 评论 -
PAT1041 Be Unique
找出只出现过一次的数,用各种排序必然超时,需要用数组做hash表 Sample Input 1:7 5 31 5 88 67 88 17Sample Output 1:31Sample Input 2:5 888 666 666 888 888Sample Output 2:None #include <stdio.h> #include <stdlib.h&g...原创 2012-11-23 23:43:46 · 130 阅读 · 0 评论 -
PAT1003 Emergency
Sample Input 5 6 0 2 1 2 1 5 3 0 1 1 0 2 2 0 3 1 1 2 1 2 4 1 3 4 1 Sample Output 2 4 #include <iostream> using namespace std; #define INF 1000000 int Graph[500][50...原创 2012-11-29 23:46:47 · 143 阅读 · 0 评论 -
PAT1020 Tree Traversals
已知中序遍历 后序遍历,求层次遍历 Sample Input: 7 2 3 1 5 7 6 4 1 2 3 4 5 6 7 Sample Output: 4 1 6 3 5 7 2 #include <string.h> #include <iostream> using namespace std; #define M...原创 2012-11-21 23:54:13 · 115 阅读 · 0 评论 -
PAT1019 General Palindromic Number
十进制转任意进制,并比较是否是回文数 Sample Input 1: 27 2 Sample Output 1: Yes 1 1 0 1 1 Sample Input 2: 121 5 Sample Output 2: No 4 4 1 #include <string.h> #include <iostream&...原创 2012-11-21 23:53:47 · 109 阅读 · 0 评论 -
PAT1037 Magic Coupon
Sample Input: 4 1 2 4 -1 4 7 6 -2 -3 Sample Output: 43 #include <iostream> #include <string.h> #include <vector> #include <algorithm> #include ...原创 2012-11-21 15:46:15 · 98 阅读 · 0 评论 -
PAT1002 A+B for Polynomials
多项式加法 Sample Input 2 1 2.4 0 3.2 2 2 1.5 1 0.5 Sample Output 3 2 1.5 1 2.9 0 3.2 #include <iostream> #include <iomanip> #include <vector> using namespace std; ...原创 2012-11-18 23:56:20 · 91 阅读 · 0 评论 -
PAT1004 Counting Leaves
统计树的每一层上叶子节点的个数 Sample Input 2 1 01 1 02 Sample Output 0 1 #include <iostream> #include <iomanip> #include <string> #include <map> #include <vector> us...原创 2012-11-18 23:56:58 · 96 阅读 · 0 评论 -
PAT1005 Spell It Right
计算各个数字的和,并用英文将字母一个一个输出。 Sample Input: 12345 Sample Output: one five #include <iostream> #include <string> using namespace std; char* fun(int x) { switch(x) { ca...原创 2012-11-18 23:57:30 · 94 阅读 · 0 评论 -
PAT1006 Sign In and Sign Out
请根据记录找出当天开门和关门的人。 Sample Input: 3 CS301111 15:30:28 17:00:10 SC3021234 08:00:00 11:25:25 CS301133 21:45:00 21:58:40 Sample Output: SC3021234 CS301133 #include <io...原创 2012-11-18 23:57:56 · 115 阅读 · 0 评论 -
PAT1007 Maximum Subsequence Sum
求最大连续子串和 Sample Input: 10 -10 1 2 3 4 -5 -23 3 7 -21 Sample Output: 10 1 4 #include <iostream> #include <vector> #include <string> using namespace ...原创 2012-11-18 23:58:22 · 87 阅读 · 0 评论 -
PAT1008 Elevator
电梯上升一层6秒,下降一层4秒,每层停留5秒Sample Input: 3 2 3 1 Sample Output: 41 #include <iostream> using namespace std; int main() { int N; cin>>N; int current = 0...原创 2012-11-19 23:49:30 · 93 阅读 · 0 评论 -
PAT1009 Product of Polynomials
多项式乘法 Sample Input 2 1 2.4 0 3.2 2 2 1.5 1 0.5 Sample Output 3 3 3.6 2 6.0 1 1.6 #include <string.h> #include <iostream> #include <iomanip> using namespa...原创 2012-11-19 23:50:03 · 97 阅读 · 0 评论 -
PAT1011 World Cup Betting
Sample Input 1.1 2.5 1.7 1.2 3.0 1.6 4.1 1.2 1.1 Sample Output T T W 37.98 #include <iostream> #include <iomanip> #include <string> using namespace std; int ma...原创 2012-11-19 23:50:31 · 105 阅读 · 0 评论 -
PAT1012 The Best Rank
四门功课,输出排名最高的是哪个 Sample Input 5 6 310101 98 85 88 310102 70 95 88 310103 82 87 94 310104 91 91 91 310105 85 90 90 310101 310102 310103 310104 310105 999999 Sample Output 1 C 1 M ...原创 2012-11-19 23:50:55 · 103 阅读 · 0 评论 -
PAT1015 Reversible Primes
十进制转任意进制 假设十进制数为number,转换的进制为digits,则将numbers%digits(根据余数的情况做相应处理) 结果保存在字符串str中,将numbers变为numbers/digits;直到numbers为零。 得到的结果为逆序,需要将其倒转,倒转后即为所求。 这里不需要倒序,直接转 Sample Input: 73 10...原创 2012-11-19 23:51:45 · 122 阅读 · 0 评论 -
PAT1024 Palindromic Number
Sample Input 1: 67 3 Sample Output 1: 484 2 Sample Input 2: 69 3 Sample Output 2: 1353 3 #include <iostream> #include <string> #include <iomanip> ...原创 2012-11-20 23:51:23 · 108 阅读 · 0 评论 -
PAT1038 Recover the Smallest Number
由一道面试题改的 把数组排成最小的数 不同之处是这个是直接按字符串处理的 Sample Input: 5 32 321 3214 0229 87 Sample Output: 22932132143287 #include <iostream> #include <string> #include <sstre...原创 2012-11-20 23:52:17 · 140 阅读 · 0 评论 -
PAT1013 Battle Over Cities
Sample Input 3 2 3 1 2 1 3 1 2 3 Sample Output 1 0 0 #include <iostream> #include <string.h> using namespace std; int map[1000][1000]={0}; int copy_map[1000][1000...原创 2012-11-29 23:59:51 · 130 阅读 · 0 评论