PAT-2018年冬季考试-乙级】的更多相关文章

很荣幸这次能够参加乙级考试,和大佬们同台竞技了一次,这篇博客,进行介绍这次2019冬季的乙级考试题解. 7-1 2019数列 (15分) 把 2019 各个数位上的数字 2.0.1.9 作为一个数列的前 4 项,用它们去构造一个无穷数列,其中第 n(>)项是它前 4 项之和的个位数字.例如第 5 项为 2, 因为 2,个位数是 2. 本题就请你编写程序,列出这个序列的前 n 项. 输入格式: 输入给出正整数 n(≤). 输出格式: 在一行中输出数列的前 n 项,数字间不要有空格. 输入样例: 1…
1152 Google Recruitment 思路:判断素数 #include<bits/stdc++.h> using namespace std; const int maxn = 1100; int a[maxn]; int n,k; long long getNum(int pos){ long long x = 0; for(int i=pos;i<=pos+k-1;i++){ x = x*10 + a[i]; } return x; } bool prime(long lo…
1091 N-自守数 代码: #include <bits/stdc++.h> using namespace std; int T; int A(int a) { ; while(a) { a /= ; cnt ++; } return cnt; } int Pow(int a, int b) { ; ; i <= b; i ++) ans *= a; return ans; } int main() { scanf("%d", &T); while(T -…
A Good In C纯模拟题,用string数组读入数据,注意单词数量的判断 #include<bits/stdc++.h> using namespace std; ; ][]; int main () { ;i<=;i++) { ;j<=;j++) cin>>a[i][j]; } string t; getchar (); getline (cin,t); ]; ; ;i<t.length();i++) { if (t[i]>='A'&&…
距离上次我一个人参加PAT考试已经过去快一个学期了,想想上次自己也是搞笑,自己一个人被这个书包就去了ZZ,人生地不熟的,乘坐公交车还坐反了.考完试因为不知道要等到考试结束就可以领取成绩证书,自己连那张不及格的证书都没有领,就急着赶火车回到了学校.因为这个周末就参加考试了,所以考试前做几道题熟悉一下试题的难度. 今天再做一下上次没有做出来的题目发现,这些题真的没涉及到什么算法,都是一些基础的模拟题,可是有些数据卡的我是不知所措,所以也很难得满分. 1086 就不告诉你 (15 分) 做作业的时候,…
题目链接 https://www.patest.cn/contests/gplt/L1-005 题意 有一个 考生号,一个试机座位,一个考试座位,给出试机座位,查询 考生号和考试座位 思路 MAP + 结构体 AC代码 #include <iostream> #include <cstdio> #include <algorithm> #include <cmath> #include <deque> #include <vector>…
7-3 Summit (25分)   A summit (峰会) is a meeting of heads of state or government. Arranging the rest areas for the summit is not a simple job. The ideal arrangement of one area is to invite those heads so that everyone is a direct friend of everyone. No…
A 1140 Look-and-say Sequence 简单模拟.可能要注意字符串第一个字符和最后一个字符的处理. #include <cstdio> #include <iostream> #include <algorithm> #include <string> #include <vector> using namespace std; string numToString(int n) { string tmpStr; int tmp…
1. 实验代码; #include<stdio.h> ; void search(char a,int *p){ if(a=='X'){ ) *p=; ; printf("U"); }else if(a=='T'){ ) *p=; ; printf("D"); money=money+; }else if(a=='C'){ *p=; printf("!"); money=money-; } } int main(void){ ]; s…
1. 实验代码: #include<stdio.h> int main (void) { int n, initial_n; scanf("%d", &n); initial_n = n; ] = {'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j'}; ] = {, , 'S', 'B', 'Q', 'W', 'S', 'B', 'Q', 'Y'}; ]={}; ; ; ; ) { i = n % ; n /= ; c…