随笔分类 -  C++

摘要:例题2-1 aabb 输出所有形如aabb的4位完全平方数(即前两位数字相等,后两位数字也相等)。 代码: #include <stdio.h> int main() { for (int x = 1;; x++) { int n = x * x; if (n < 1000) { continue; 阅读全文
posted @ 2020-08-12 14:41 Techoc 阅读(109) 评论(0) 推荐(0)
摘要:习题1-1 平均数 输入3个整数,输出它们的平均数,保留3为小数 代码: #include <stdio.h> int main() { double a, b, c; scanf("%lf%lf%lf", &a, &b, &c); printf("%.3f", (a + b + c) / 3); 阅读全文
posted @ 2020-08-12 11:43 Techoc 阅读(172) 评论(0) 推荐(0)
摘要:算法竞赛入门经典第二版——第一章例题 例题 1-1 圆柱体的表面积 输入底面半径r和高h,输出圆柱体的表面积,保留三位小数,格式: 样例输入: 3.5 9 样例输出: Area = 274.889 代码: #include <stdio.h> #include <math.h> int main() 阅读全文
posted @ 2020-08-10 22:32 Techoc 阅读(133) 评论(0) 推荐(0)