
字符串总结
叫我莫言鸭
这个作者很懒,什么都没留下…
展开
-
A1082 并没有通过我也不知道原因
总结:1.如果后面都是零,则不输出后面;2.如果前面是零,且有要输出的位数,如800080,八十万零八十 ,80800八十万零八千,这些,位数都是在零之前输出,而一般的数都是在位数之前输出;所以,如果我这个数不是零,就先输出这个数,在输出位数,如果是零,先输出位数,在输出零3.标记一定要记得切换,当输出不为零的数时标记改为true,为零则false,4关于后面全为零跳出,我用了check...原创 2019-08-13 21:51:34 · 155 阅读 · 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 · 278 阅读 · 1 评论 -
getchar与gets
当gets前面有scanf("")等时,需要用getchar吃掉回车;而gets,也会吃掉回车所以当gets gets接连使用时,并不需要getchar吃掉回车;原创 2019-08-13 01:47:38 · 408 阅读 · 0 评论 -
A1035
思考:1.首先我想的是直接的进行输入输出,但是,关键为题在于,他第一个输出的,是改变的个数,所以,不能在循环输入时直接输出;2.我尝试用map去存储用户,但是,map会自动按照键大小排序,打乱答案顺序,如果要确保输出顺序的话,只有另起一个容器去保存这个顺序,但是这样,map就毫无意义;3.队列先进先出想法,我认为是可以实现的,但是并没有进行实践操作;4.我认为的最优——算法笔记的结构体;...原创 2019-08-13 00:37:09 · 148 阅读 · 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 · 194 阅读 · 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 · 105 阅读 · 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 · 2060 阅读 · 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 · 172 阅读 · 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 · 138 阅读 · 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 · 307 阅读 · 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 · 170 阅读 · 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 · 166 阅读 · 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 · 319 阅读 · 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 · 166 阅读 · 0 评论 -
关于字符串的录入
当题中出现符号,例如“ :” ,“/ "."等可以直接将符号带入,当然,这些是已知格式才能这样例如 2017/06/08 scanf("%d/%d/%d")原创 2019-08-11 19:58:08 · 155 阅读 · 0 评论