2021年3月5日
摘要: 1051 复数乘法 (15 分) https://pintia.cn/problem-sets/994805260223102976/problems/994805274496319488 复数可以写成 (A+Bi) 的常规形式,其中 A 是实部,B 是虚部,i 是虚数单位,满足 i ​2 ​​=− 阅读全文
posted @ 2021-03-05 09:27 小明很萌 阅读(55) 评论(0) 推荐(0)
  2021年3月4日
摘要: 一般输入用cin即可,但是cin遇到空格和换行符结束 1,如果不定长输入带有空格的字符串可以用getline(cin,s),(其中s为前面定义的string类型) 2,getchar()是在输入缓冲区顺序读入一个字符(包括空格、回车和Tab) 阅读全文
posted @ 2021-03-04 14:03 小明很萌 阅读(55) 评论(0) 推荐(0)
  2021年3月3日
摘要: 1012 The Best Rank (25 分) https://pintia.cn/problem-sets/994805342720868352/problems/994805502658068480 To evaluate the performance of our first year 阅读全文
posted @ 2021-03-03 17:54 小明很萌 阅读(42) 评论(0) 推荐(0)
摘要: 1040 有几个PAT (25 分)https://pintia.cn/problem-sets/994805260223102976/problems/994805282389999616 字符串 APPAPT 中包含了两个单词 PAT,其中第一个 PAT 是第 2 位(P),第 4 位(A),第 阅读全文
posted @ 2021-03-03 15:10 小明很萌 阅读(54) 评论(0) 推荐(0)
摘要: 1035 插入与归并 (25 分)https://pintia.cn/problem-sets/994805260223102976/problems/994805286714327040 根据维基百科的定义: 插入排序是迭代算法,逐一获得输入数据,逐步产生有序的输出序列。每步迭代中,算法从输入序列 阅读全文
posted @ 2021-03-03 11:49 小明很萌 阅读(41) 评论(0) 推荐(0)
摘要: 1034 有理数四则运算 (20 分) https://pintia.cn/problem-sets/994805260223102976/problems/994805287624491008 本题要求编写程序,计算 2 个有理数的和、差、积、商。 输入格式: 输入在一行中按照 a1/b1 a2/ 阅读全文
posted @ 2021-03-03 09:09 小明很萌 阅读(61) 评论(0) 推荐(0)
  2021年3月1日
摘要: 1024 科学计数法 (20 分) 链接:https://pintia.cn/problem-sets/994805260223102976/problems/994805297229447168 科学计数法是科学家用来表示很大或很小的数字的一种方便的方法,其满足正则表达式 [+-][1-9].[0 阅读全文
posted @ 2021-03-01 16:40 小明很萌 阅读(91) 评论(0) 推荐(0)
摘要: 数字a转为字符串s为string s=to_string(a) 字符串s转为数字:a=stoi(s) 单个字符化为数字为:c-'0' 数字化为单个字符为:i+'0'; 小写字母转为大写字符为 char C=c-32; ASCII的值是从0~127之间 bool 类型的数组默认初始都是false, 阅读全文
posted @ 2021-03-01 11:26 小明很萌 阅读(517) 评论(0) 推荐(0)
摘要: 下面通过代码给大家介绍c++ string insert() 函数,具体内容如下: basic_string& insert (size_type pos, const basic_string& str); 在原串下标为pos的字符前插入字符串str basic_string& insert (s 阅读全文
posted @ 2021-03-01 11:20 小明很萌 阅读(762) 评论(0) 推荐(0)
摘要: 1019 数字黑洞 (20 分) 链接:https://pintia.cn/problem-sets/994805260223102976/problems/994805302786899968 给定任一个各位数字不完全相同的 4 位正整数,如果我们先把 4 个数字按非递增排序,再按非递减排序,然后 阅读全文
posted @ 2021-03-01 11:13 小明很萌 阅读(51) 评论(0) 推荐(0)