自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(41)
  • 收藏
  • 关注

原创 PAT1049 数列的片段和 (20分)(C语言)

Sample Input40.1 0.2 0.3 0.4Sample Output5.00思路: 考虑每一位的数出现的次数。代码#include<stdio.h>int main(){ int n; scanf("%d",&n); int i; double a[100005]; for(i=0;i<n;i++){ scanf("%...

2019-12-31 10:49:10 252

原创 PAT1015 德才论 (25分)(C++语言, sort函数, 结构体排序)

Sample Input14 60 8010000001 64 9010000002 90 6010000011 85 8010000003 85 8010000004 80 8510000005 82 7710000006 83 7610000007 90 7810000008 75 7910000009 59 9010000010 88 4510000012 80 ...

2019-12-31 10:41:30 226 1

原创 PAT写作模板(给自己看的啦)

Sample InputSample Output思路:代码就为了以后写文章方便一点。。。大家加油!!!

2019-12-31 10:36:55 215

原创 PAT1038 统计同成绩学生 (20分)(C语言)

Sample Input1060 75 90 55 75 99 82 90 75 503 75 90 88Sample Output3 2 0思路: 用一个数组直接对所有的输入的分数的人计数,然后用第二个数组记录询问,最后直接打印即可。代码#include<stdio.h>int main(){ int n; int k; int i...

2019-12-31 10:34:59 252

原创 PAT1032 挖掘机技术哪家强 (20分)(C语言)

Sample Input63 652 801 1002 703 403 0Sample Output2 150思路: 直接找最大就完事了,没难度。代码#include<stdio.h>int main(){ int n; scanf("%d",&n); int i; int a,b; int scor...

2019-12-31 10:28:39 225

原创 PAT1044 火星数字 (20分)(C语言)

Sample Input4295elo novtamSample Outputhel marmay11513思路: 打表神题,13进制 - 10进制转化,然后按照他的对应转化即可。代码#include<stdio.h>#include<string.h>int main(){ char a[100]; int n; int i;...

2019-12-31 10:22:41 532

原创 PAT1028 人口普查 (20分)(C语言)

Sample Input5John 2001/05/12Tom 1814/09/06Ann 2121/01/30James 1814/09/05Steve 1967/11/20Sample Output3 Tom John思路: 注意去掉不合理的部分,然后就可以判断输入的年龄,找最年轻和最老的。代码#include<iostream>#include&lt...

2019-12-31 10:18:43 314

原创 PAT1092 最好吃的月饼 (20分)(C语言)

Sample Input5 31001 992 0 233 68 0 2018 0 200836 18 0 1024 4Sample Output20183 5思路: 月饼很好吃,模拟就完事了。代码#include<stdio.h>int main(){ int n,m; scanf("%d %d",&n,&m); int i,j...

2019-12-31 10:15:07 303

原创 PAT1065 单身狗 (25分)(C语言)

Sample Input311111 2222233333 4444455555 66666755555 44444 10000 88888 22222 11111 23333Sample Output510000 23333 44444 55555 88888思路:我打开这道题的时候是条单身狗,现在已经有一个可爱的、美丽的女朋友啦,希望每个快乐的程序员都有自己所爱...

2019-12-31 10:10:53 664

原创 PAT1024 科学计数法 (20分)(C语言)

Sample Input 1+1.23400E-03Sample Output 10.00123400Sample Input 2-1.2E+10Sample Output 2-12000000000思路: 字符串输入,先记录符号位,然后将E之前的数字转化成数字,将E后面的数字转化成幂的数。然后计算。代码#include<stdio.h>#include...

2019-12-31 10:00:12 594 2

原创 PAT(A)1105 Spiral Matrix (25分)

Sample Input1237 76 20 98 76 42 53 95 60 81 58 93Sample Output98 95 9342 37 8153 20 7658 60 76思路: 排序 + 模拟,螺旋摆放。代码:#include <iostream>#include <algorithm>#include <cstdio&...

2019-12-31 09:40:49 81

原创 PAT(A)1070 Mooncake (25分)

Sample Input3 200180 150 1007.5 7.2 4.5Sample Output9.45思路: 模拟就完事了,不过要细心!!!题意要求出最省钱的方案,算单价,排序,尽量便宜就好。代码:#include <iostream>#include <cstdio>#include <cstring>#include ...

2019-12-21 22:52:46 62

原创 PAT(A)1152 Google Recruitment (20分)

Sample Input 120 523654987725541023819Sample Output 149877Sample Input 210 32468024680Sample Output 2404思路: 暴力打法,直接对k长度的数字,判断是不是素数即可。复杂度很高。。。代码:#include <iostream>#include &lt...

2019-12-21 22:46:02 49

原创 PTA(A)1120 Friend Numbers (20分)

Sample Input8123 899 51 998 27 33 36 12Sample Output43 6 9 26思路: 输入同时记录数字各位的总和,添加到一个vector里,最后排序输出即可,注意重复判断。代码:#include <iostream>#include <cstdio>#include <algorithm>#...

2019-12-21 21:44:27 73

原创 PAT(A)1117 Eddington Number (25分)

Sample Input106 7 6 9 3 10 8 2 7 8Sample Output6思路: 题意是找出有n天的里程超过n,求最大的n。直接对数组排序,然后反向遍历找出天数大于等于里程的那一天,天数 - 1 = 答案。代码:#include <iostream>#include <cstdio>#include <string&gt...

2019-12-21 17:01:28 79

原创 PAT(A)1061 Dating (20分)

Sample Input3485djDkxh4hhGE 2984akDfkkkkggEdsb s&hgsfdk d&HyscvnmSample OutputTHU 14:04思路: 模拟题意:1.第一第二行第一个重复的 大写字母(A - G) 作为周几约会。2.第一第二行第二个重复的 数字或大写字母(0 - 9, A - N) 作为约会开始的小时。3.第三...

2019-12-19 01:13:33 150

原创 PAT(A)1084 Broken Keyboard (20分)

Sample Input7_This_is_a_test_hs_s_a_esSample Output7TI思路: 题意,第一行代表要求输入的字符串,第二行代表实际输入的字符串,需要知道哪些键坏了。记录第二个串的字符,然后再遍历第一个,输出没有的即可,注意要求字母全大写,且每种只能输出一次。代码:#include <iostream>#include <c...

2019-12-17 14:26:09 67

原创 PAT(A)1031 Hello World for U (20分)

Sample Inputhelloworld!Sample Outputh !e dl llowor思路: 模拟就好。代码:#include <stdio.h>#include <string.h>char a[101];int main(){ gets(a); int k = (strlen(a) + 2)...

2019-12-17 10:22:37 78

原创 PAT(A)1050 String Subtraction (20分)

Sample InputThey are students.aeiouSample InputThy r stdnts.思路: 题意是给两行字符串,第二行字符串中的字符不能被输出。我输入用的是gets(),但其实不是很好。记录第二行的字符,然后输出第一行可以的字符。代码:#include <iostream>#include <cstdio>#in...

2019-12-16 11:49:18 57

原创 PAT(A)1058 A+B in Hogwarts (20分)

Sample Input3.2.1 10.16.27Sample Output14.1.28思路: 题意是给两组数字,给定转换方法1 * G = 17 * S1 * S = 29 * K求解加和结果。只要将所有的数字都转化成一个然后相加再求值即可。代码:#include <iostream>#include <cstdio>#include &...

2019-12-16 11:32:36 82

原创 PAT(A)1009 Product of Polynomials (25分)

Sample Input2 1 2.4 0 3.22 2 1.5 1 0.5Sample Output3 3 3.6 2 6.0 1 1.6思路: 多项式乘法,用三个数组存储多项式1, 2, 结果。输出有几个项,和这几个项对应的指数和系数。代码:#include <iostream>#include <cstdio>#include <algo...

2019-12-14 23:57:04 58

原创 PAT(A)1025 PAT Ranking (25分)

Sample Input251234567890001 951234567890005 1001234567890003 951234567890002 771234567890004 8541234567890013 651234567890011 251234567890014 1001234567890012 85Sample Output912345678...

2019-12-14 23:07:34 102

原创 PAT(A)1029 Median (25分)

Sample Input4 11 12 13 145 9 10 15 16 17Sample Output13思路: 这题居然卡了内存,题意就是在两个有序数组合并,并找中位数。正常做法会内存超限,可以先输入一个数组,然后动态操作第二个数组,中位数位置是(n + m + 1) / 2。寻找对应位置的数字,如果第二个数组输入完依旧没有,重新回到第一个数组里继续。感谢柳神。代码:...

2019-12-14 21:33:19 107

原创 PAT1091 N-自守数 (15分)(C语言)

Sample Input392 5 233Sample Output3 253921 25No思路: 直接求值即可,成立输出答案,不成立输出No代码:#include<stdio.h>#include<math.h>int main(){ int n; scanf("%d",&n); int i; int...

2019-12-12 21:21:36 238

原创 PAT1094 谷歌的招聘 (20分)(C语言)

Sample Input 120 523654987725541023819Sample Output 149877Sample Input 210 32468024680Sample Output 2404思路: 暴力打法,直接对k长度的数字,判断是不是素数即可。复杂度很高。。。代码:#include<stdio.h>#include<mat...

2019-12-12 21:17:43 1185

原创 PAT(A)1003 Emergency (25分)

Sample Input:5 6 0 21 2 1 5 30 1 10 2 20 3 11 2 12 4 13 4 1Sample Output:2 4思路: 题意是输出最短路的条数与最短路上可以有的最大救援队数目。num[v] - v点最短路数目dis[v] - v点的距离w[v] - v点最大的救援队数目dijkstra算法,求最短路,并更新最短路数目与救援...

2019-12-12 21:03:42 76

原创 PAT(A)1100 Mars Numbers (20分)

Sample Input4295elo novtamSample Outputhel marmay11513思路: 打表输出,乙级里有一样的题目。代码:#include <stdio.h>#include <string.h>char first[13][15] = {"tret", "jan", "feb", "mar", "apr"...

2019-12-11 16:33:05 53

原创 PAT1086 就不告诉你 (15分)(C语言)

Sample Input5 7Sample Output53思路: 算出乘积,逆序输出。代码:#include<stdio.h>int main(){ int a,b; scanf("%d %d",&a,&b); int n; n=a*b; int c[1000]; int i=0; while(n!=0){ c[i]=n%...

2019-12-09 11:18:21 484 2

原创 PAT(B)1004 成绩排名 (20分)(C语言)

Sample Input:3Joe Math990112 89Mike CS991301 100Mary EE990830 95Sample Output:Mike CS991301Joe Math990112思路: 直接找就完事了。代码:#include<stdio.h>int main(){ char name[1000][80]; char n...

2019-12-09 11:15:29 201

原创 PAT1059 C语言竞赛 (20分)(C语言)

Sample Input61111666688881234555500016888800011111222288882222Sample Output8888: Minion0001: Chocolate1111: Mystery Award2222: Are you kidding?8888: Checked2222: Are you kidding...

2019-12-09 11:11:41 188

原创 PAT1033 旧键盘打字 (20分)(C语言)

Sample Input:7+IE.7_This_is_a_test.Sample Output:_hs_s_a_tst思路: 和另一个题有点像,步骤反过来,输出结果。代码:#include<stdio.h>#include<string.h>char a[100005];char b[100005];int main(){ int n;...

2019-12-09 11:05:39 465

原创 PAT1020 月饼 (25分)(C语言)

Sample Input:3 2018 15 1075 72 45Sample Output:94.50思路: 直接模拟,然后注意细节,里面有小坑。代码:#include<bits/stdc++.h>using namespace std;struct sss{ double v; //库存量 double p;//总售价 double w;//一万吨的...

2019-12-09 11:01:08 117

原创 PAT(B)1029 旧键盘 (20分)(C语言)

Sample Input:7_This_is_a_test_hs_s_a_esSample Output:7TI思路: 对比两个字符串,寻找缺失的字符,记录即可。代码:#include<stdio.h>#include<string.h>int main(){ char a[100]; char b[100]; char c[100]; g...

2019-12-09 10:57:32 144

原创 PAT(A)1023 Have Fun with Numbers (20分)

Sample Input:1234567899Sample Output:Yes2469135798思路: 题意:输入一个长度不大于20的正整数,计算其双倍,先输出是否是原数字的改变排列,然后输出双倍结果。代码:#include <iostream>#include <cstdio>#include <algorithm>#includ...

2019-12-07 00:27:27 120

原创 PAT(A)1101 Quick Sort (25分)

Sample Input:51 3 2 4 5Sample Output:31 4 5思路: 找快排的枢轴,对快排要有足够的了解。代码:#include <iostream>#include <cstdio>#include <algorithm>#include <vector>using namespace std...

2019-12-06 21:35:15 76

原创 PAT(A)1093 Count PAT's (25分)

Sample Input:APPAPTSample Output:2思路: 和乙级一道题目完全一样,只是把题干换成了英文,对应的题目就是最经典的奶牛碑文问题,后往前遍历就可以解决,记录到当前位置的对应字符串长度即可。代码:#include <iostream>#include <string>using namespace std;const i...

2019-12-06 21:28:52 60

原创 PAT(A)1065 A+B and C (64bit) (20分)

Sample Input:31 2 32 3 49223372036854775807 -9223372036854775808 0Sample Output:Case #1: falseCase #2: trueCase #3: false思路: 题意:判断A + B > C,成立输出true,否则输出false。唯一的问题,数据范围很大,涉及到大数范围。我偷了个...

2019-12-06 21:22:57 61

原创 PAT(A)1048 Find Coins (25分)

Sample Input 1:8 151 2 8 7 2 4 11 15Sample Output 1:4 11Sample Input 2:7 141 8 7 2 4 11 15Sample Output 2:No Solution思路: 题意:输入n, m,然后输入n个数,找V1, V2相加的于m。有点桶排序的味道,遍历到m的一半,找V1,若V1, V2判断都存...

2019-12-06 21:17:52 55

原创 PAT(A)1012 The Best Rank (25分)

Sample Input5 6310101 98 85 88310102 70 95 88310103 82 87 94310104 91 91 91310105 85 90 90310101310102310103310104310105999999Sample Output1 C1 M1 E1 A3 AN/A思路: 题意大致是给你C,M,E的成绩...

2019-12-06 21:03:44 62

原创 PAT(A)1046 Shortest Distance (20 分)

Sample Input5 1 2 4 14 931 32 54 1Sample Output3107思路: 计算两个出口的最短距离,注意这是一个环,可以从两边计算。代码:#include <bits/stdc++.h>using namespace std;int a[10001];int main(){ int n; sc...

2019-12-02 14:29:46 67

空空如也

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除