PAT
Allen2401
这个作者很懒,什么都没留下…
展开
-
PAT 1001 A+B format
#include<iostream>using namespace std; //这是一个递归过程void digui(int c,int flag){ int temp = c/1000; if(temp){ digui(temp,1); c = c%1000; printf("%03d",c); }else { cout<<...原创 2019-06-21 15:35:35 · 87 阅读 · 0 评论 -
PAT 1016 Phone Bills
1016 Phone Bills (25 分)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 wh...原创 2019-07-04 16:05:29 · 95 阅读 · 0 评论 -
PAT 1013 Battle Over Cities
这一道题难吗?不难,呜呜呜,但还是卡了好久,去他娘的段错误,孩子被原创 2019-06-28 13:52:09 · 113 阅读 · 0 评论 -
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), and E - Eng...原创 2019-06-28 13:43:21 · 84 阅读 · 0 评论 -
PAT 1011 Wodld Cup Betting
emm,这道题不难,为啥有的题难到死,有些题简单到死#include<iostream>#include<algorithm>using namespace std;pair<double,char> p[3];int main(){ float one,two,three; float sum=1; for(int i=0;i<...原创 2019-06-28 13:07:41 · 87 阅读 · 0 评论 -
PAT 1010 Radix
来,让我们从头到尾得观察一下这道1、以为最大进制为36以内。但注意:题目中只说了数字的取值为0-9,a-z,进制大于每一个数字。并没有说进制的范围!!!!!!!!再强调一遍,没有给进制的范围。给定一个字符串,只能判断出这个字符串的最小的进制,最大。。并不是36。2、我的思路是将s2从最小进制开始向radix进制转换,如果转换出的字符串记为temp,想一想,停止的条件是什么?如果用...原创 2019-06-24 22:15:23 · 120 阅读 · 0 评论 -
PAT 1015 Reversible Primes
这道题不难,嘿嘿嘿#include<iostream>#include<cmath> using namespace std;int getNum(int c1,int radix){ int result =0; while(c1) { result = result*radix+c1%radix; //除模 c1 = c1/rad...原创 2019-07-01 20:36:48 · 109 阅读 · 0 评论 -
PAT 1009 Product of Polynomials
这个题我本来想着用数组,但万一太稀疏的话太浪费空间,感觉用map的话有三点好处:1、节省空间2、不同计数,用map.size() 就好了3、序列都是排好的,甚至反向输出也很6但我STL用的不多,先记录刚才做题过程中百度的东西,做个小总结:1、插入用insert(make_pair(first,second);2、删除用erase(iter)或者erase(first);...原创 2019-06-22 20:42:17 · 87 阅读 · 0 评论 -
PAT 1008 Elevator
这道题也太简单了吧,不敢相信#include<iostream>using namespace std;int main(){ int n,m,last=0,sum = 0; cin>>n; for(int i=0;i<n;i++) { cin>>m; if(m-last>=0) sum+=(m-last)*6+5;...原创 2019-06-22 19:15:20 · 93 阅读 · 0 评论 -
PAT 1007 Maximum Subsequence Sum
这道题,按道理来说得一遍过,但是呢,因为一个等号耽搁了太长的时间,掌嘴。幸好得到了一个大佬的帮助。#include<iostream>using namespace std;//这是哟个最大序列和问题,计算以当前结束 int num[10005];int main(){ int n,m,tempsum=0,start=0,end=0,tempstart=0,...原创 2019-06-22 19:03:11 · 97 阅读 · 0 评论 -
PAT 1006 Sign In and Sign Out
哇,今天早上有如神助,又一次唰唰全过~#include<iostream>#include<vector> #include<string>using namespace std;struct Person{ string id; string start; string end; Person(){} Person(string i...原创 2019-06-22 11:29:35 · 202 阅读 · 0 评论 -
PAT 1005 spell it right
这是我目前唯一一次过了全部测试用例的题,流出了心酸的泪~#include<iostream>#include<string>using namespace std;string input;//循环遍历拿到每一位数 string english[] = {"zero","one","two","three","four","five","six","...原创 2019-06-22 11:04:59 · 167 阅读 · 0 评论 -
PAT 1004 Counting Leaves
根据题目我们注意到:根节点固定是1,所以我想当然地认为第一行肯定输入的是01的子节点,就因为这一点,头发都掉了100根先把错误的代码粘出来#include<iostream>#include<cstring>using namespace std;//tree -1表示这个节点不存在,1表示这个节点是叶节点,0表示这个节点不是叶节点 //level ...原创 2019-06-21 15:54:58 · 113 阅读 · 0 评论 -
PAT 1003 Emergency
#include<iostream>using namespace std;#define mmax 10000int dis[500][500];int eachnum[500],visited[500],tempdis[500],num[500],count[500];//num用来表示什么呢?用来表示包括这个城市在内路径上的救护队数量 int main(){...原创 2019-06-21 15:45:29 · 89 阅读 · 0 评论 -
PAT 1002 A+B for Polynomials
#include<iostream>#include<cstring>#include<cmath>using namespace std;#define zero 0.000001float sum[1001]; int getPloynomials(){ int n,index,max = -1; float num; cin>&...原创 2019-06-21 15:39:40 · 128 阅读 · 0 评论 -
PAT 1014 Waiting in Line
1014 Waiting in Line (30 分)Suppose a bank has NNN windows open for service. There is a yellow line in front of the windows which devides the waiting area into two parts. The rules for the customers ...原创 2019-07-04 16:12:47 · 115 阅读 · 0 评论