PTA
文章平均质量分 77
madhi12
这个作者很懒,什么都没留下…
展开
-
PTA 自测-4 Have Fun with Numbers (20分)
Notice that the number 123456789 is a 9-digit number consisting exactly the numbers from 1 to 9, with no duplication. Double it we will obtain 246913578, which happens to be another 9-digit number consisting exactly the numbers from 1 to 9, only in a diff原创 2020-05-23 17:16:50 · 214 阅读 · 0 评论 -
1017 A除以B (20分)
本题要求计算 A/B,其中 A 是不超过 1000 位的正整数,B 是 1 位正整数。你需要输出商数 Q 和余数 R,使得 A=B×Q+R 成立。 输入格式: 输入在一行中依次给出 A 和 B,中间以 1 空格分隔。 输出格式: 在一行中依次输出 Q 和 R,中间以 1 空格分隔。 输入样例: 123456789050987654321 7 输出样例: 17636684150141093474 3 #include <iostream> #include <string> using原创 2020-05-21 15:31:40 · 118 阅读 · 0 评论 -
PTA 用虚函数分别计算各种图形的面积
PTA 用虚函数分别计算各种图形的面积 定义抽象基类Shape,由它派生出五个派生类:Circle(圆形)、Square(正方形)、Rectangle( 长方形)、Trapezoid (梯形)和Triangle (三角形),用虚函数分别计算各种图形的面积,并求出它们的和。要求用基类指针数组。使它的每一个元素指向一个派生类的对象。PI=3.1415926 输入格式: 请在这里写输入格式。例如:输入在一行中给出9个大于0的数,用空格分隔,分别代表圆的半径,正方形的边长,矩形的宽和高,梯形的上底、下底和高,三角原创 2020-05-20 09:23:52 · 2429 阅读 · 3 评论