习题
叫我莫言鸭
这个作者很懒,什么都没留下…
展开
-
A1082 并没有通过我也不知道原因
总结:1.如果后面都是零,则不输出后面;2.如果前面是零,且有要输出的位数,如800080,八十万零八十 ,80800八十万零八千,这些,位数都是在零之前输出,而一般的数都是在位数之前输出;所以,如果我这个数不是零,就先输出这个数,在输出位数,如果是零,先输出位数,在输出零3.标记一定要记得切换,当输出不为零的数时标记改为true,为零则false,4关于后面全为零跳出,我用了check...原创 2019-08-13 21:51:34 · 106 阅读 · 0 评论 -
A1035
思考:1.首先我想的是直接的进行输入输出,但是,关键为题在于,他第一个输出的,是改变的个数,所以,不能在循环输入时直接输出;2.我尝试用map去存储用户,但是,map会自动按照键大小排序,打乱答案顺序,如果要确保输出顺序的话,只有另起一个容器去保存这个顺序,但是这样,map就毫无意义;3.队列先进先出想法,我认为是可以实现的,但是并没有进行实践操作;4.我认为的最优——算法笔记的结构体;...原创 2019-08-13 00:37:09 · 117 阅读 · 0 评论 -
A1001
#include<stdio.h>#include<iostream>#include<string>#include<algorithm>int num[15];using namespace std;/* run this program using the console pauser or add your own getch, ...原创 2019-08-12 23:18:24 · 144 阅读 · 0 评论 -
B1048 反转求
总结reverse是在algorithm中,并且,使用时,必须要放的是地址,如reverse(s,s+a);#include<stdio.h>#include<iostream>#include<string>#include<algorithm>const int maxn = 110;char A[maxn], B[maxn], a...原创 2019-08-12 22:32:33 · 78 阅读 · 0 评论 -
B1048 非法的间接寻址错误
总结:反转两次;反转时,i=0时,i<len/2,切记没有等于号; #include<stdio.h> #include<iostream> #include<string> #include<algorithm> const int maxn = 110; char A[maxn], B[maxn...原创 2019-08-12 22:23:22 · 1990 阅读 · 0 评论 -
B1048
总结:gets(str)和getline(cin,str)可以吸收空格,以回车为终止符; #include<stdio.h> #include<iostream> #include<string> using namespace std; /* run this program using the console p...原创 2019-08-12 21:58:21 · 141 阅读 · 0 评论 -
B1024 续
#include<stdio.h>#include<iostream>#include<string>using namespace std;/* run this program using the console pauser or add your own getch, system("pause") or input loop */int ...原创 2019-08-12 21:21:36 · 104 阅读 · 0 评论 -
B1024
#include<stdio.h>#include<iostream>#include<string>using namespace std;/* run this program using the console pauser or add your own getch, system("pause") or input loop */int ...原创 2019-08-12 13:31:40 · 260 阅读 · 0 评论 -
B1014
知识点总结printf(“%0md”,i) 输出m位整数i,当位数不够时,用0到前面补#include<stdio.h>#include<iostream>#include<string>#include<iostream>#include<algorithm>#define Time(a,b,c) a*10000+b*1...原创 2019-08-12 09:08:46 · 129 阅读 · 0 评论 -
B1009(EOF的应用)
#include <iostream>#include<string.h>#include<stdio.h> using namespace std;char str[90][90]; int main(int argc, char** argv) { int num=0; while(scanf("%s",ans[num])!=EOF)//当sc...原创 2019-08-11 21:44:51 · 120 阅读 · 0 评论 -
B1002
#include <iostream> #include<string.h> #include<stdio.h> using namespace std; char change[][]= int main(int argc, char** argv) { char str[110];//用字符数组存储输入...原创 2019-08-11 21:38:34 · 272 阅读 · 0 评论 -
B1031
#include <iostream>#include<stdio.h> using namespace std;int main(int argc, char** argv) { int w[20]={7,9,10,5,8,4,2,1,6,3,7,9,10,5,8,4,2}//加权对应关系 char M[15]={'1','0','X','9','8','7'...原创 2019-08-11 20:51:41 · 135 阅读 · 0 评论 -
B1006
#include <iostream>#include<stdio.h> using namespace std;int main(int argc, char** argv) { int n; scanf("%d",&n); int num=0,ans[5]; do{ ans[num++]=n%10; n/=10; }while(n) f...原创 2019-08-11 20:11:53 · 125 阅读 · 0 评论 -
A1006续
#include<stdio.h>#include<string>#include<iostream>#define Time(a,b,c) a*10000+b*100+cusing namespace std;int main(){ int n, h, m, s; long long min = 246060, max = 0; scanf...原创 2019-08-11 18:00:52 · 82 阅读 · 0 评论 -
A1006
#include<stdio.h>#include<string>#include<iostream>using namespace std;struct person{ char id[20]; int hh,mm,ss;}temp,early,last;bool cmp(person a,person b){ if(a.hh!=b.h...原创 2019-08-11 17:38:24 · 176 阅读 · 0 评论 -
B1010 转自算法笔记
#include<stdio.h>#include<string>#include<iostream>using namespace std;char S[3]={'W','T','L'};int main(){ double ans=1.0,max,a; int index; for(int i=0;i<3;i++) { max=...原创 2019-08-11 17:11:32 · 119 阅读 · 0 评论 -
B1028(转自算法笔记)
#include<stdio.h>#include<string>#include<iostream>using namespace std;struct person{ string name; int yy,mm,dd;}oldest,youngest,left,right,tempbool LessEqu(person a,person...原创 2019-08-11 16:50:15 · 241 阅读 · 0 评论 -
B1041
每个PAT考生在参加考试时都会被分配两个座位号,一个是试机座位,一个是考试座位。正常情况下,考生在入场时先得到试机座位号码,入座进入试机状态后,系统会显示该考生的考试座位号码,考试时考生需要换到考试座位就座。但有些考生迟到了,试机已经结束,他们只能拿着领到的试机座位号码求助于你,从后台查出他们的考试座位号码。输入格式:输入第一行给出一个正整数N(<=1000),随后N行,每行给出一个考生...原创 2019-08-10 17:55:32 · 440 阅读 · 0 评论 -
A1077
总结1.当gets()前有回车要输入,必须用getchar()吃掉回车;2.reverse(it1,it2) [it1,it2)地址; #include<stdio.h>#include<iostream>#include<string>#include<map>#include<string.h>#include<...原创 2019-08-13 08:19:50 · 224 阅读 · 1 评论