
PAT-甲级
文章平均质量分 95
Prime's Blog
借夜阑静处,独看天涯星
展开
-
A1016 Phone Bills (25分)
A1016 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 when the call is made. When a customer starts connect原创 2020-12-08 11:10:21 · 189 阅读 · 0 评论 -
A1012 The Best Rank (25分)
A1012 The Best Rank (25分)一、题目描述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 - English. At the mean time,原创 2020-12-07 18:55:48 · 165 阅读 · 0 评论 -
B1015 德才论 (25分)
B1015 德才论 (25分)一、题目描述宋代史学家司马光在《资治通鉴》中有一段著名的“德才论”:“是故才德全尽谓之圣人,才德兼亡谓之愚人,德胜才谓之君子,才胜德谓之小人。凡取人之术,苟不得圣人,君子而与之,与其得小人,不若得愚人。”现给出一批考生的德才分数,请根据司马光的理论给出录取排名。输入格式:输入第一行给出 3 个正整数,分别为:N(≤105),即考生总数;L(≥60),为录取最低分数线,即德分和才分均不低于 L 的考生才有资格被考虑录取;H(<100),为优先录取线——德分和才原创 2020-12-06 19:03:43 · 352 阅读 · 0 评论 -
A1077 Kuchiguse (20分)
A1077 Kuchiguse (20分)一、题目描述The Japanese language is notorious for its sentence ending particles. Personal preference of such particles can be considered as a reflection of the speaker’s personality. Such a preference is called “Kuchiguse” and is often ex原创 2020-12-03 23:58:43 · 233 阅读 · 0 评论 -
A1035 Password (20分)
A1035 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 in lowercase), or 0 (zero) f原创 2020-12-03 17:07:28 · 164 阅读 · 0 评论 -
A1005 Spell It Right (20分)
A1005 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 contains one test case. Each case occupies one line原创 2020-12-03 16:17:01 · 179 阅读 · 0 评论 -
A1001 A+B Format (20分)
A1001 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).Input Specification:Each input file contains one test case.原创 2020-12-03 15:53:56 · 237 阅读 · 0 评论 -
A1036 Boys vs Girls 25分
A1036 Boys vs Girls 25分题目描述:题目大意:输入一个数N,以下N行每行输入一个学生信息,找到女生成绩最高的人和男生成绩最低的人,最后输出他们的名字、学号和成绩的差值。思路:①:连接体信息,使用结构体存储姓名,性别,id和成绩。②:使用fcot和mcot分别记录女生和男生是否都存在,若存在赋值1,在输出的时候特判cot,若cot等于0,说明不存在该类学生,输出Absent。AC代码:#include<cstdio>#include<cmath>原创 2020-11-02 11:55:07 · 21538 阅读 · 0 评论 -
A1006 Sign In and Sign Out 25分
A1006 Sign In and Sign Out 25分题目描述:题目大意:给定一个总人数,在这些人数里边找出最早的人和最晚的人,输出他们的工号。思路:①:连接体信息,所以用结构体存储工号,时间。②:因为需要比较时间,这里的时间有时、分、秒,不妨把写一个函数,当需要比较时间的时候调用该函数就好,好用又方便。AC代码:#include<cstdio>struct node{ char num[20]; int h1,m1,s1,h2,m2,s2;}e[100005],原创 2020-11-01 23:39:28 · 131 阅读 · 0 评论 -
A1011 World Cup Betting 20分
A1011 World Cup Betting 20分题目描述:题目大意:给出三场比赛的赔率,输出赔率的最大那个字母并计算两元总的利益。思路:①:边输入边比较,找出赔率最大的位置下标,用t存储起来。②:可以利用字符数组,找出下标后输出对应下标的字母。AC代码1:#include<cstdio>char b[4]={'0','W','T','L'};int main(){ double ans=1.0; for(int i=1;i<=3;i++){ doubl原创 2020-11-01 23:11:25 · 139 阅读 · 0 评论 -
A1009 Product of Polynomials 25分
A1009 Product of Polynomials 25分题目描述:思路:①:准备三个数组,两个数组分别存储多项式A和B,第三个数组存储他们的乘积。②:用cot记录非零多项式的个数,判断乘积是否等于0,若不等于0,令cot++。代码描述:#include<cstdio>double e[2005];int cot;double c[2005],d[2005];int main(){ int k,a; double b; scanf("%d",&k);原创 2020-10-30 15:12:26 · 221 阅读 · 0 评论 -
A1002 A+B for Polynomials 25分
A1002 A+B for Polynomials 25分题目描述:思路:①:使用数组存储指数和系数,例如e[3]=4就代表着指数为3的X的系数为4。②:边输入边计算,把相同指数的X的系数加起来。③:用cot来统计非零系数项的个数。由于相同指数的X的系数加起来完全有可能等于0(一正一负),我们要在他们加起来后判断系数是否等于0,不等于加cot++。代码描述:#include<cstdio>double e[1005];int book[1005],cot;int main(原创 2020-10-30 10:46:51 · 161 阅读 · 0 评论 -
B1010 一元多项式求导 25分
B1010 一元多项式求导 25分题目描述:思路:①:使用while……EOF来输入②:使用数组来存储系数和指数,例如e[3]=4,代表着指数为3的X的系数为4。③:求导应从指数小的开始,如果从指数大的数求导,则指数小的数可能会被覆盖掉,例如e[3]=4,e[2]=1代表着y=4x³+x²。若从指数为3的数开始求导,即e[3]=4 ==>e[2]=12 则原本的e[2]=1会被e[2]=12给覆盖掉导致答案错误。④:输出应该从指数大的数开始。代码描述:...原创 2020-10-29 23:51:21 · 196 阅读 · 2 评论 -
B1065 A+B and C (64bit) (20分)
B1065 A+B and C -64bit 20分题目描述:思路:由于Int的范围10的九次方以内或者是32位整数,long long 的范围是10的十八次方以内或者64位整数,题目给的范围是63位整数,所以只能用longlong存放变量。又因为变量的最大值为63位整数,当两个最大值相加时完全有可能会溢出(正溢出或者负溢出),所以我们需要判断是否会溢出。在计算机组成原理中,如果两个正数之和等于负数(正溢出)或者两个负数之和等于正数(负溢出),那么就是溢出。好了,知道了这个原理后做题就方便了。代码原创 2020-10-27 11:39:23 · 139 阅读 · 0 评论 -
A1046 Shortest Distance 20分
A1046 Shortest Distance 20分题目描述:刚开始做的时候,由于翻译错了题目导致做得不是很顺畅,三个点超时了一个。思路:以dis[i]表示从1号顶点以顺时针方向到i+1号顶点的距离,sum表示为一圈的总距离,于是对每个顶点都有总距离=顺时针+逆时针,以顶点V3为例,总距离等于顺时针V1->V2->V3的距离加上V1->V5->V4->V3,也就是逆时针距离=sum-dis[2]。接着比较顺时针和逆时针的距离输出较小的就好了。需要注意的是给出初始原创 2020-10-25 23:44:58 · 171 阅读 · 0 评论