
PAT
文章平均质量分 82
Echo.L.
这个作者很懒,什么都没留下…
展开
-
【算法笔记】问题 D: 单词替换
题目描述输入一个字符串,以回车结束(字符串长度<=100)。该字符串由若干个单词组成,单词之间用一个空格隔开,所有单词区分大小写。现需要将其中的某个单词替换成另一个单词,并输出替换之后的字符串。输入多组数据。每组数据输入包括3行,第1行是包含多个单词的字符串 s,第2行是待替换的单词a,(长度<=100)第3行是a将被替换的单词b。(长度<=100)s, a, b ...原创 2020-04-05 16:58:34 · 340 阅读 · 0 评论 -
【算法笔记】问题 C: 字符串的查找删除
题目描述给定一个短字符串(不含空格),再给定若干字符串,在这些字符串中删除所含有的短字符串。输入输入只有1组数据。输入一个短字符串(不含空格),再输入若干字符串直到文件结束为止。输出删除输入的短字符串(不区分大小写)并去掉空格,输出。样例输入in#include int main(){printf(" Hi ");}样例输出#cludetma(){p...原创 2020-04-05 00:25:34 · 376 阅读 · 0 评论 -
【算法笔记】Problem C 进制转换
#include <cstdio>#include <cstring>#include <cstdlib>int main() { char n[40]; int n_int[40]; char binary[1024]; while (gets_s(n)) { int num = 0; int lenth = strlen(n); ...原创 2020-04-04 22:11:11 · 186 阅读 · 0 评论 -
【算法笔记】问题 D: 沙漏图形
问题描述:输入n,输出正倒n层星号三角形。首行顶格,星号间有一空格,效果见样例输入样例:3输出样例:* * * * * * * * * * *解题思路:除了上下对称可以利用很简单的技巧,其他没什么好说的,直接上代码。代码:#include <stdio.h>int main(){ int h; while (scanf("%d", &h...原创 2020-04-03 19:34:37 · 1492 阅读 · 0 评论 -
【算法笔记】问题 E: Shortest Distance (20)
题目描述The task is really simple: given N exits on a highway which forms a simple cycle, you are supposed to tell the shortest distance between any pair of exits.输入Each input file contains one test ca...原创 2020-04-03 00:29:18 · 250 阅读 · 0 评论 -
【PTA题库】1001 A+B Format (20分)
Q:Calculate a+b and output the sum in standard format – that is, the digits must be separated into groups of three by commas (unless there are less than four digits).Input Specification:Each input ...原创 2020-02-22 17:38:33 · 188 阅读 · 0 评论