
PAT乙级
KK的任意门
改变,从去影响开始。
展开
专栏收录文章
- 默认排序
- 最新发布
- 最早发布
- 最多阅读
- 最少阅读
-
PAT乙级:题目二十四
题目:有几个PAT 我的代码: #include<iostream> #include<string> using namespace std; int main(){ string s; cin>>s; int a[10001] = {0},pnum = 0,tnum = 0,anum = 0; long long count...原创 2020-03-01 22:36:09 · 136 阅读 · 0 评论 -
PAT乙级:二十三
题目:到底买不买 我的代码: #include<iostream> #include<string> using namespace std; int main(){ int a[123] = {0}; string s1,s2; int z = 0,f = 0,flag = 1; cin>>s1>>s2; ...原创 2020-03-01 20:29:39 · 106 阅读 · 0 评论 -
PAT乙级:题目二十二
题目:本题要求读入N名学生的成绩,将获得某一给定分数的学生人数输出。 我的代码 #include<iostream> using namespace std; int main(){ int a[101] = {0}; int s,n,f; cin>>s; //输入学生人数 for(int i = 0;i < s;i++)...原创 2020-02-29 22:00:09 · 137 阅读 · 0 评论 -
PAT乙级:题目二十一
题目:在霍格沃茨找零钱。你的任务是写一个程序来计算他应该被找的零钱。 我的代码 #include<iostream> using namespace std; int main() { long yg,ys,yk; long sg,ss,sk; long y,s,c; scanf("%ld.%ld.%ld",&yg,&ys,&y...原创 2020-02-29 21:32:41 · 143 阅读 · 0 评论 -
PAT乙级:题目二十
题目:跟奥巴马一起编程 我的代码: #include<iostream> using namespace std; int main(){ double num; char c; int k; cin>>num>>c; k = num/2 + 0.5; //四舍五入得到宽 //输出 ...原创 2020-02-29 20:50:42 · 113 阅读 · 0 评论 -
PAT乙级:题目十九
题目:现给定原始序列和由某排序算法产生的中间序列,请你判断该算法究竟是哪种排序算法? 我的代码 #include<iostream> using namespace std; //数中间序列有多少个排好序的数字 int Count(int A[],int num){ //A的序号从1开始 int c = 1; for(int i = 1;i < num ;i...原创 2020-02-29 00:04:16 · 230 阅读 · 0 评论 -
PAT乙级:题目十八
题目:本题要求编写程序,计算2个有理数的和、差、积、商。 我的代码: #include<iostream> //做完这道题想一下小数四舍五入的方法 (1066)#include<cstdio> #include<string> (765)#include<algorithm> using namespace std; void yuefen...原创 2020-02-27 23:34:08 · 109 阅读 · 0 评论 -
PAT乙级:题目十七
题目:现在给定一些身份证号码,请你验证校验码的有效性,并输出有问题的号码。 我的代码: #include<iostream> #include<cstdio> #include<string> using namespace std; int find(int n,int a[]){ for(int i = 0;i <10;i++){ ...原创 2020-02-18 16:55:06 · 269 阅读 · 0 评论 -
PAT乙级:题目十六
题目:旧键盘上坏了几个键,于是在敲一段文字的时候,对应的字符就不会出现。现在给出应该输入的一段文字、以及实际被输入的文字,请你列出肯定坏掉的那些键。 我的代码: #include<iostream> #include<cstdio> #include<string> using namespace std; void StoA(string s,int a[...原创 2020-02-17 12:57:33 · 161 阅读 · 0 评论 -
PAT乙级:题目十五
题目:某城镇进行人口普查,得到了全体居民的生日。现请你写个程序,找出镇上最年长和最年轻的人。 我的代码: #include<iostream> #include<cstdio> #include<string> #include<algorithm> using namespace std; typedef struct{ int year...原创 2020-02-16 23:23:30 · 118 阅读 · 0 评论 -
PAT乙级:题目十五
题目:打印沙漏 我的代码: #include<iostream> #include<cstdio> using namespace std; int main(){ int N,rest,need,count = 0,max =1,j = 0; char c; cin>>N>>c; int a[1000]; ...原创 2020-02-15 20:32:24 · 212 阅读 · 0 评论 -
PAT乙级:题目十四
题目:这里不妨简单假设常数CLK_TCK为100。现给定被测函数前后两次获得的时钟打点数,请你给出被测函数运行的时间。 我的代码: #include<iostream> #include<cstdio> #include<cmath> using namespace std; int main(){ long long a,b,zm,m,f,h; ...原创 2020-02-14 11:12:08 · 149 阅读 · 0 评论 -
PAT乙级:题目十三
题目:给定一个常数K以及一个单链表L,请编写程序将L中每K个结点反转。例如:给定L为1→2→3→4→5→6,K为3,则输出应该为3→2→1→6→5→4;如果K为4,则输出应该为4→3→2→1→5→6,即最后不到K个元素不反转。 (实际上为静态链表的局部翻转) 我的代码:没有AC 参考代码一:利用栈 链接:https://www.nowcoder.com/questionTerminal/5f44c...原创 2020-02-14 00:18:30 · 307 阅读 · 0 评论 -
PAT乙级:题目十二
题目:现以科学计数法的格式给出实数A,请编写程序按普通数字表示法输出A,并保证所有有效位都被保留 我的代码: #include<iostream> #include<cstdio> #include<string> #include<algorithm> using namespace std; int main(){ string s,l...原创 2020-02-11 23:44:57 · 142 阅读 · 0 评论 -
PAT乙级:题目十一
题目:给定数字0-9各若干个。你可以以任意顺序排列这些数字,但必须全部使用。目标是使得最后得到的数尽可能小(注意0不能做首位)。例如:给定两个0,两个1,三个5,一个8,我们得到的最小的数就是10015558。 我的代码: #include<cstdio> #include<iostream> #include<string> using namespace s...原创 2020-02-11 11:37:57 · 251 阅读 · 0 评论 -
PAT乙级:题目十
题目:输入两个非负10进制整数A和B(<=230-1),输出A+B的D (1 < D <= 10)进制数。 我的代码: #include<iostream> #include<cstdio> #include<string> #include<algorithm> using namespace std; int main(){ ...原创 2020-02-10 22:41:44 · 151 阅读 · 0 评论 -
PAT乙级:题目九
题目:给定一个k位整数N = dk-110k-1 + … + d1101 + d0 (0<=di<=9, i=0,…,k-1, dk-1>0),请编写程序统计每种不同的个位数字出现的次数。例如:给定N = 100311,则有2个0,3个1,和1个3。 我的代码: #include<cstdio> #include<iostream> #include<...原创 2020-02-10 22:00:55 · 373 阅读 · 0 评论 -
PAT乙级:题目八
给定任一个各位数字不完全相同的4位正整数,如果我们先把4个数字按非递增排序,再按非递减排序,然后用第1个数字减第2个数字,将得到一个新的数字。一直重复这样做,我们很快会停在有“数字黑洞”之称的6174,这个神奇的数字也叫Kaprekar常数。 我的代码: #include<cstdio> #include<iostream> #include<algorithm>...原创 2020-02-09 22:58:43 · 163 阅读 · 0 评论 -
PAT乙级:题目七
大家应该都会玩“锤子剪刀布”的游戏:现给出两人的交锋记录,请统计双方的胜、平、负次数,并且给出双方分别出什么手势的胜算最大。 我的代码: #include<iostream> #include<cstdio> using namespace std; //***输出“B”“C”"J"中赢得次数最多的那个***// int output(int num[]){ in...原创 2020-02-08 20:43:30 · 149 阅读 · 0 评论 -
PAT 乙级:题目六
本题要求计算A/B,其中A是不超过1000位的正整数,B是1位正整数。你需要输出商数Q和余数R,使得A = B * Q + R成立。 自己代码: #include<cstdio> #include<iostream> #include<string> using namespace std; int main(){ string A; int B...原创 2020-02-08 13:45:24 · 157 阅读 · 0 评论 -
PAT乙级:题目五
正整数A的“DA(为1位整数)部分”定义为由A中所有DA组成的新整数PA。例如:给定A = 3862767,DA = 6,则A的“6部分”PA是66,因为A中有2个6。 现给定A、DA、B、DB,请编写程序计算PA + PB。 自己代码: #include<cstdio> #include<iostream> #include<math.h> using nam...原创 2020-02-07 20:12:20 · 451 阅读 · 0 评论 -
PAT乙级:题目四
德才论 自己代码: #include<cstdio> #include <iostream> using namespace std; typedef struct{ char number[9]; int p1; int p2; }student; int main(){ int num,point1,point2; int...原创 2020-02-06 23:25:13 · 129 阅读 · 0 评论 -
PAT乙级:题目三
大侦探福尔摩斯接到一张奇怪的字条:“我们约会吧! 3485djDkxh4hhGE 2984akDfkkkkggEdsb s&hgsfdk d&Hyscvnm”。大侦探很快就明白了,字条上奇怪的乱码实际上就是约会的时间“星期四 14:04”,因为前面两字符串中第1对相同的大写英文字母(大小写有区分)是第4个字母’D’,代表星期四;第2对相同的字符是’E’,那是第5个英文字母,代表一天...原创 2020-02-05 18:14:09 · 249 阅读 · 0 评论 -
题目二
给定一系列正整数,请按要求对数字进行分类,并输出以下5个数字: A1 = 能被5整除的数字中所有偶数的和; A2 = 将被5除后余1的数字按给出顺序进行交错求和,即计算n1-n2+n3-n4…; A3 = 被5除后余2的数字的个数; A4 = 被5除后余3的数字的平均数,精确到小数点后1位; A5 = 被5除后余4的数字中最大数字。 自己代码: include<stdio.h> #in...原创 2020-02-04 16:58:48 · 252 阅读 · 0 评论 -
PAT乙级:题目一
给定区间[-2的31次方, 2的31次方]内的3个整数A、B和C,请判断A+B是否大于C。 注解:主要是考察数的表示范围,用的数据类型是否会溢出 代码: (1)自己提交的: #include <stdio.h> int main(){ int count,num=1; long a,b,c; int flag = 1; scanf("%d",&c...原创 2020-02-04 12:29:15 · 159 阅读 · 0 评论