- 博客(10)
- 收藏
- 关注
原创 PAT A1020
经典的二叉树算法,很遗憾我现在还很菜 #include<cstdio> #include<queue> #include<algorithm> #include<cstring> using namespace std; const int maxn =50; int n,post[maxn],in[maxn]; struct node{ int data; node* lchild; node* rchild; //必须分别写两行 }; node*
2021-03-30 23:10:51 70
原创 1055 集体照
#include #include //醉了。。居然是字母排序的问题。。 using namespace std; struct student{ int h; string name; }st[10010]; bool cmp(student a,student b){ if(a.h == b.h) return a.name<b.name; return a.h>b.h; }...
2020-02-19 22:16:08 89
原创 PAT 乙 1042 字符统计 测试点2 是 a 。。。
#include using namespace std; //测试点2 是 a 。。。。 int main() { string s; getline(cin,s); int M[128] = { 0 }; for(int i = 0;i<s.length();i++){ if(s[i]>=‘A’&&s[i]<=‘Z’) M[s[i]+32]++; else i...
2020-02-18 23:29:33 377
原创 1094 谷歌的招聘 (20分)测试的2和5
测试点2和5要是两个都不过的话就是l-k的遍历没有遍历到最后一位数 注释已经在代码上打出来了 #include<stdio.h> #include<iostream> #include<cmath> using namespace std; bool isPrime(int n){ if(n<=1)return false; for(int i = 2...
2020-01-31 23:10:43 808
原创 1064 朋友数(20 分
#include<stdio.h> #include<set> using namespace std; int change(int a){ int sum=0; while(a/10){ sum += a%10; a = a/10; } sum += a; return sum; } int main(){ int n,x,y; scanf("%d...
2019-10-07 22:23:13 86
原创 1077 互评成绩计算 (20 分)
#include<stdio.h> int main(){ int n,m,g; scanf("%d %d",&n,&m); for(int k = 0;k<n;k++){ //保持输入?? //惊了原来是互评 int a[n]; int max = 0,min = 0xffff,count = 0; for(int i = 0;i...
2019-09-30 11:13:09 161
原创 1072 开学寄语 (20 分)
#include<stdio.h> #include using namespace std; int main(){ int n,m; scanf("%d%d",&n,&m); int thing[10]; //违禁物品编号 for(int i = 0;i<m;i++){ scanf("%d",&thing[i]); } char id[8]; i...
2019-09-29 08:55:46 85
原创 1078 字符串压缩与解压(20 分
#include<stdio.h> #include #include #include using namespace std; int main(){ char a; scanf("%c\n",&a); getchar(); //好神奇!! //万恶之源getchar() string s; getline(cin,s); if(a ==‘C’){ for(int i = ...
2019-09-28 23:08:46 141
原创 1057 数零壹 (20 分)
#include<stdio.h> #include<string.h> #include #include using namespace std; int main(){ string str; getline(cin,str); //新的输入方式 惊了! int sum = 0; for(int i = 0;i<str.length() ;i++){ if...
2019-09-28 21:43:18 138
原创 惊了,我居然学着开始写博客了···
#2019/7/11 第一次试着开始写博客,完全没有什么经验,打算着想到哪就写到哪。这里是一个远离我日常社交的一个不错的空间,一些羞耻PLY一般的事我也可以在这里分享。希望我能变成一个更好的自己··· 第一件事,就是学习编程。打算在假期结束后去考一次编程(最简单的那种),当然计算机等级考试我觉得太弱了,给人一种土气的感觉,也浪费精力,反正到最后也是要跟着大溜考的,没必要现在就准备这种。这次考试必然...
2019-07-12 00:56:40 98
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人