摘要: 思路: 用一个新的字符数组存组合后的新字符串,先把第一串字符串的前半部分存入新字符串,然后把第二串字符串全部存入,最后存入第一串字符串的后半部分。 #include <stdio.h> #include <iostream> #include <cstring> using namespace st 阅读全文
posted @ 2021-01-20 20:29 FantasticDoulbeFish 阅读(182) 评论(0) 推荐(0) 编辑
摘要: 要注意 所有单词由一个或多个空格分隔,有如下几种特殊情况; 1,“end of file ” 3,“ end of file” 3,“end of file ” 4,“ end of file ” #include <stdio.h> #include <iostream> #include <cs 阅读全文
posted @ 2021-01-20 19:43 FantasticDoulbeFish 阅读(503) 评论(0) 推荐(0) 编辑
摘要: 解题思路:找字符位置的规律。除了最后一行为2n-1个字符全部输出,其余行的字符位置满足pos1==n+i-1和pos2=n-i+1(i为行数,从1开始) #include <stdio.h> using namespace std; int main() { char a; int n; while 阅读全文
posted @ 2021-01-20 17:58 FantasticDoulbeFish 阅读(1002) 评论(0) 推荐(0) 编辑
摘要: 解题思路: 先考虑这个人没有18岁生日的情况。显然只有可能是2月29日出生的,而且出生后的第18年一定不是闰年(18不是4的倍数)。因此,2月29日出生的人没有18岁生日,输出-1。 再考虑不是2月29日出生的情况,当年生日到第二年生日所经过的天数,不是365天,就是366天。之所以有时候会经过36 阅读全文
posted @ 2021-01-20 17:10 FantasticDoulbeFish 阅读(412) 评论(0) 推荐(0) 编辑