摘要: 求数列的和 思路:利用sqrt函数计算根号,再依次累计相加 代码: #include<iostream> #include<math.h> using namespace std; int main() { double m, n; double num, sum; while (cin >> m 阅读全文
posted @ 2020-02-01 22:29 PCDL&TIPO 阅读(112) 评论(0) 推荐(0) 编辑
摘要: 数值统计 思路:分为正数,负数,0,三类,然后分别统计 代码: #include<iostream> using namespace std; int main() { int n; double num; int a, b, c; while (cin >> n&&n) { a = b = c = 阅读全文
posted @ 2020-02-01 21:58 PCDL&TIPO 阅读(130) 评论(0) 推荐(0) 编辑
摘要: 平方和与立方和 思路:判断奇数偶数,分别计算 代码: #include<iostream> using namespace std; int main() { int m, n; int num1, num2; while (cin >> m >> n) { int t, i; num1 = num 阅读全文
posted @ 2020-02-01 21:56 PCDL&TIPO 阅读(128) 评论(0) 推荐(0) 编辑
摘要: 求奇数的乘积 思路:输入数据,判断奇数偶数,然后计算奇数乘积。 代码: #include<iostream> using namespace std; int main() { int n; int num, sum; while (cin >> n) { sum = 1; for (int i = 阅读全文
posted @ 2020-02-01 21:52 PCDL&TIPO 阅读(141) 评论(0) 推荐(0) 编辑
摘要: 第几天? 思路:构建一个闰年和非闰年的二维数组模型:int a[2][13] = { { 0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 }, { 0, 31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 阅读全文
posted @ 2020-02-01 21:37 PCDL&TIPO 阅读(101) 评论(0) 推荐(0) 编辑
摘要: 成绩转换 思路:提前设好数组char a[] = "EEEEEEDCBAA";计算成绩%10,看看是什么成绩 代码: #include<iostream> using namespace std; int main() { char a[] = "EEEEEEDCBAA"; int num; whi 阅读全文
posted @ 2020-02-01 21:30 PCDL&TIPO 阅读(192) 评论(0) 推荐(0) 编辑
摘要: 求绝对值 思路:利用fabs函数计算绝对值,最后输出。 代码: #include<iostream> #include<math.h> using namespace std; int main() { double num; while (cin>>num) { printf("%0.2lf\n" 阅读全文
posted @ 2020-02-01 21:25 PCDL&TIPO 阅读(119) 评论(0) 推荐(0) 编辑
摘要: 计算球体积 思路:输入数据,利用公式计算体积。 注:PI的值以及小数位数 代码: #include<iostream> #define PI 3.1415927 using namespace std; int main() { double r; while (cin >> r) { printf 阅读全文
posted @ 2020-02-01 21:21 PCDL&TIPO 阅读(122) 评论(0) 推荐(0) 编辑
摘要: ASCII码排序 思路:利用ascll表比较大小 代码: #include<iostream> using namespace std; int main() { char a, b, c, t; while (cin >> a >> b >> c) { if (a > c) { t = a; a 阅读全文
posted @ 2020-02-01 21:15 PCDL&TIPO 阅读(118) 评论(0) 推荐(0) 编辑
摘要: 计算两点间的距离 思路:录入数据后,利用两点间公式计算答案 代码: #include<iostream> #include<math.h> using namespace std; int main() { double x1, y1, x2, y2; while (cin >> x1 >> y1 阅读全文
posted @ 2020-02-01 21:03 PCDL&TIPO 阅读(128) 评论(0) 推荐(0) 编辑
摘要: An easy problem 规律:当a >= 'a'&&a <= 'z' 时,sum = -(a - 'a') - 1; 当a >= 'A'&&a <= 'Z'时,sum = a - 'A' + 1; 代码: #include<iostream> using namespace std; int 阅读全文
posted @ 2020-02-01 20:59 PCDL&TIPO 阅读(91) 评论(0) 推荐(0) 编辑