
PAT
编程题
不停---
吹皱一池春水
buting.site
展开
-
PAT 1015
#include<iostream>#include<math.h>#include<string>using namespace std;bool isPrime(int a){ if(a==1) return false; int n=sqrt(a); for(int i=2;i<=n;i++) { if(a%i==0) return false; }原创 2020-06-26 14:09:01 · 159 阅读 · 0 评论 -
PAT 1032 --- Sharing
1.存在错误,可能是输入中存在多余链表,未作筛选,懒的改了。#include<vector>#include<iostream>#include<unordered_map>#include<unordered_set>using namespace std;int main(){ char data[1000000];//结点地址有5位数字,故这个哈希表数组至少要开到10的6次方 int Next[1000000];//结点地原创 2020-06-24 22:32:55 · 174 阅读 · 0 评论 -
PAT A 1041Be unique
#include<iostream>using namespace std;int main(){ int n; scanf("%d",&n); int num[n]; int count[10000]={0}; for(int i=0;i<n;i++) { scanf("%d",&num[i]...原创 2020-04-28 20:51:27 · 159 阅读 · 0 评论 -
PAT A 1038
#include<iostream>#include<string.h>#include<algorithm>using namespace std;bool cmp(string& a,string& b){ return a+b<b+a;}int main(){ int N; scanf("%d"...原创 2020-04-27 16:03:12 · 165 阅读 · 0 评论 -
PAT A 1083--- List Grades
#include<iostream>#include<algorithm>using namespace std;struct node{ char name[20]; char ID[20]; int grade;};bool cmp(node a,node b){ return a.grade>b.grade;}i...原创 2020-04-26 22:55:33 · 115 阅读 · 0 评论 -
PAT 1005 Spell it right
#include<iostream>#include<vector>using namespace std;int main(){ string n[10]={"zero","one","two","three","four","five","six","seven","eight","nine"}; string num; cin>&...原创 2020-04-09 23:24:02 · 114 阅读 · 0 评论 -
PAT 1007 MAXIMUM SUBSEQUENCE SUM
#include<iostream>using namespace std;int main(){ int N; scanf("%d",&N); int num[N]; for(int i=0;i<N;i++) scanf("%d",&num[i]); int left=0,right=0,maxval...原创 2020-04-08 23:56:50 · 146 阅读 · 0 评论 -
PAT 1051 PopSequence
#include<iostream>#include<stack>using namespace std;int main(){ int M,N,K; scanf("%d %d %d",&M,&N,&K); while (K--) { int A[N],t=0; for(int ...原创 2020-03-26 15:33:49 · 137 阅读 · 0 评论 -
PAT AD 1047 Student List for Course
#include<iostream>#include<queue>#include<string>#include<algorithm>using namespace std;struct students{ char name[5]; int c;};struct courses{ queue<st...原创 2020-03-24 22:53:44 · 135 阅读 · 0 评论 -
PAT A 1028
#include<iostream>#include<algorithm>using namespace std;struct student{ /* data */ char ID[10]; char name[10]; int grade;};bool cmp1(student a,student b){ for(...原创 2020-03-22 23:09:14 · 110 阅读 · 0 评论 -
PAT AD 1035 Password
#include<iostream>using namespace std;struct user{ char username[11];// username char password[11];//password};int main(){ int N; scanf("%d",&N); user storage[N]; ...原创 2020-03-21 21:16:34 · 151 阅读 · 0 评论 -
PAT A 1046
#include<iostream>using namespace std;int main(){ int N; cin>>N; int sumdis=0; int distance[N]; for(int i=0;i<N;i++) { cin>>distance[i]; ...原创 2020-03-20 16:37:24 · 114 阅读 · 0 评论 -
PAT A 1011 World Cup Betting
#include<iostream>using namespace std;int maxx(double Panel[3][3],int line){ int max=0; int res=0; for(int i=0;i<3;i++) { if(Panel[line][i]>max) { ...原创 2020-03-17 15:15:49 · 144 阅读 · 0 评论 -
PAT A 1054 The Domain color
#include<iostream>#include<algorithm>using namespace std;int main(){ int M,N; cin>>M>>N; int Pix[M*N]; for(int i=0;i<M*N;i++) scanf("%d",&Pix...原创 2020-03-16 18:49:48 · 136 阅读 · 0 评论 -
1036 Boys VS Girls PAT AD
#include<iostream>using namespace std;struct student{ char name[11]; char ID[11]; int grade; char gender;};int main(){ int n; cin>>n; student test[n]; ...原创 2020-03-12 19:08:07 · 148 阅读 · 0 评论 -
PAT A 1006 Signin and Signout
本题主要有两个要点1.数据的输入2.cmp函数的编写#include<iostream>#include<algorithm>using namespace std;struct user{ char ID[16]; int h; int m; int s; int h1; int m1; int s1;...原创 2020-03-08 16:44:36 · 121 阅读 · 0 评论 -
PAT A 1027 colors in Mars
进制转换问题 难度不大#include<iostream>#include<vector>using namespace std;vector<char> res;void check(int color){ char c; if(color<13) { res.push_back('0'); ...原创 2020-03-06 16:01:11 · 161 阅读 · 0 评论 -
PAT A 1008 Elevator 20 points
#include<iostream>#include<vector>using namespace std;int totaltime=0;void gotoo(int now,int next){ //up if(now<=next) { totaltime+=(next-now)*6+5; } el...原创 2020-03-02 22:31:03 · 131 阅读 · 0 评论 -
PAT Ranking A1025
251234567890001 951234567890005 1001234567890003 951234567890002 771234567890004 8541234567890013 651234567890011 251234567890014 1001234567890012 85//只有22分 存在一个测试点过不去()#include<iost...原创 2020-02-19 16:37:52 · 143 阅读 · 0 评论 -
PAT A 1001 A+B
question:https://pintia.cn/problem-sets/994805342720868352/problems/994805528788582400//第一次写的笨办法 没有拿到全分,主要考虑到数据不大,就这样写了#include<iostream>#include<math.h>using namespace std;int main(...原创 2019-10-06 16:05:56 · 89 阅读 · 0 评论 -
PAT 乙级 1041 15分考试座位号
题目:https://pintia.cn/problem-sets/994805260223102976/problems/* 将试机号作为数组下标 */#include <stdio.h>#include <string.h>typedef struct {char examNum[15];//准考证号int seatNum;//座位号} examiee...原创 2019-02-17 19:26:18 · 185 阅读 · 0 评论 -
PABASIC 1092
题目:https://pintia.cn/problem-sets/994805260223102976/problems/1071785779399028736#include<iostream>using namespace std;int main(){ int n, m;//n 为月饼种类 m为参评城市数 cin >> n >> m; in...原创 2019-05-01 21:48:38 · 236 阅读 · 0 评论 -
PATBASIC 1064
TIMU:https://pintia.cn/problem-sets/994805260223102976/problems/994805267416334336#include<iostream>#include<algorithm>//如果两个整数各位数字的和是一样的,则被称为是“朋友数”,而那个公共的和就是它们的“朋友证号”。//例如 123 和 51 就是...原创 2019-05-01 18:55:46 · 160 阅读 · 0 评论 -
PAT 乙级 1040 25分 有几个PAT
题目:https://pintia.cn/problem-sets/994805260223102976/problems/994805282389999616//f复杂度太大#include<stdio.h>#include<string.h>int main(){ char s[10000]; scanf("%s",&s); int len; ...原创 2019-04-03 14:38:45 · 123 阅读 · 0 评论 -
PAT 乙级 1026 程序运行时间 15分
题目:https://pintia.cn/problem-sets/994805260223102976/problems/994805295203598336#include<iostream>using namespace std;#include<time.h>int main(){ double c1,c2; cin>>c1>>...原创 2019-04-02 22:31:51 · 215 阅读 · 0 评论 -
PAT 乙级 1027 打印沙漏 20分
题目:https://pintia.cn/problem-sets/994805260223102976/problems/99480529425149132818分 希望大佬看看哪出错了#include<iostream>using namespace std;int main(){ int n; char c; scanf("%d %c",&n,&c...原创 2019-04-02 22:09:09 · 155 阅读 · 0 评论 -
PAT 乙级 1032 挖掘机技术哪家强 20分
题目:https://pintia.cn/problem-sets/994805260223102976/problems/994805289432236032#include<iostream>using namespace std;class student{ public: int school; int grade;};int main(){ int ...原创 2019-04-01 22:10:43 · 135 阅读 · 0 评论 -
PAT 乙级 1030 完美数列 25分
题目:https://pintia.cn/problem-sets/994805260223102976/problems/994805291311284224#include<stdio.h>int main(){ int n,p; scanf("%d%d",&n,&p); int s[n+1]; for(int i=1;i<n+1;i++) {...原创 2019-03-27 19:49:23 · 220 阅读 · 0 评论 -
PAT 乙级 1091 自守数 15分
题目:https://pintia.cn/problem-sets/994805260223102976/problems/1071785664454127616#include<stdio.h>#include<math.h>int main(){ int m; scanf("%d",&m); int k; for(...原创 2019-03-24 15:57:38 · 215 阅读 · 0 评论 -
PAT BASIC 1084
TIMU:https://pintia.cn/problem-sets/994805260223102976/problems/994805260583813120#include<iostream>using namespace std;int main(){ string a; int n; cin >> a >> n; while(--n)...转载 2019-05-02 11:47:55 · 120 阅读 · 0 评论 -
PAT BASIC 1083
timu:https://pintia.cn/problem-sets/994805260223102976/problems/994805260780945408#include<iostream>#include<iomanip>#include<math.h>using namespace std;int main(){ int n; c...原创 2019-05-02 12:52:34 · 95 阅读 · 0 评论 -
PAT BASIC 1088
题目:https://pintia.cn/problem-sets/994805260223102976/problems/1038429286185074688#include<iostream>#include<math.h>using namespace std;int reverse(int n){ int i = n % 10; int j = (n...原创 2019-05-01 12:19:11 · 116 阅读 · 0 评论 -
PAT BASIC 1020
题目:https://pintia.cn/problem-sets/994805260223102976/problems/994805301562163200#include<iostream>#include<iomanip>#include<algorithm>using namespace std;struct MoonCake{ doubl...转载 2019-05-01 11:23:29 · 115 阅读 · 0 评论 -
PAT BASIC 1058 选择题
题目:https://pintia.cn/problem-sets/994805260223102976/problems/994805270356541440原创 2019-04-25 11:47:08 · 185 阅读 · 0 评论 -
PAT BASIC 1042
题目:https://pintia.cn/problem-sets/994805260223102976/problems/994805280817135616#include<iostream>#include<vector>#include<string>#include<cctype>using namespace std;int ...原创 2019-04-29 20:25:51 · 138 阅读 · 0 评论 -
PAT BASIC 1066 图像过滤
题目:https://pintia.cn/problem-sets/994805260223102976/problems/994805266514558976#include<iostream>int main(){ int m, n, a, b, point; scanf("%d %d %d %d %d\n", &m, &n, &a, &b...原创 2019-04-20 15:49:26 · 135 阅读 · 0 评论 -
PAT BASIC 1044 火星数字
题目:https://pintia.cn/problem-sets/994805260223102976/problems/994805279328157696/* * (读取字符要注意回车的处理 可回顾一下 1018. 锤子剪刀布) * 1. 创建二维字符数组的 长度 * 2. 含高位的火星文,如果低位是0,不输出 */#include <stdio.h>#includ...转载 2019-04-20 14:43:34 · 200 阅读 · 0 评论 -
PAT BASIC 1015 德才论
题目:https://pintia.cn/problem-sets/994805260223102976/problems/994805307551629312原创 2019-04-27 21:19:29 · 132 阅读 · 0 评论 -
PAT 1087 有多少不同值 20分 乙级
题目:https://pintia.cn/problem-sets/994805260223102976/problems/1038429191091781632#include<stdio.h>int main(){ int n; scanf("%d",&n); int result[n]; int count=0; for...原创 2019-03-24 15:06:55 · 196 阅读 · 0 评论 -
PAT 乙级 1086 15分 就不告诉你
题目:https://pintia.cn/problem-sets/994805260223102976/problems/1038429065476579328#include<stdio.h>int main(){ int x,y; scanf("%d%d",&x,&y); int s; s=x*y; if(s==0) ...原创 2019-03-24 14:43:21 · 205 阅读 · 0 评论