- 博客(11)
- 收藏
- 关注
原创 两整数排序
//1020: 两整数排序int main(){ int x = 0, y = 0; scanf("%d %d", &x, &y); int max = x > y ? x : y; int min = x > y ? y : x; printf("%d %d", min, max); return 0;}
2022-03-03 23:51:44
379
原创 求公园门票
1019: 公园门票int main(){ int num = 0; scanf("%d", &num); if (num >= 30) printf("%d", num * 48); else printf("%d", num * 50); return 0;}
2022-03-03 23:51:02
1003
原创 判断奇数偶数
//1018: 奇数偶数int main(){ int num = 0; scanf("%d", &num); if (num % 2 == 0) printf("even"); else printf("odd"); return 0;}
2022-03-03 23:50:07
105
原创 判断正整数位数
#include<stdio.h>int main(){ int num = 0; scanf("%d", &num); if (num / 10000 > 0) printf("5"); if (num / 1000 > 0 && num / 1000 < 10) printf("4"); if (num / 100 > 0 && num / 100 < 10) printf("3"); if.
2022-03-03 23:49:24
171
原创 计算时间间隔
#include<stdio.h>int main(){ int h1 = 0, h2 = 0, m1 = 0, m2 = 0, s1 = 0, s2 = 0; scanf("%d:%d:%d", &h1, &m1, &s1); scanf("%d:%d:%d", &h2, &m2, &s2); printf("%d", (h2 * 3600 + m2 * 60 + s2)-(h1 * 3600 + m1 * 60 +s1)); r.
2022-02-14 18:18:46
427
原创 求三角形的面积
#include<stido.h>#include<math.h>int main(){ double a = 0, b = 0, c = 0, S = 0, p = 0; scanf("%lf %lf %lf", &a, &b, &c); p = (a + b + c) / 2; S = pow(p * ( p - a)*(p - b)*(p - c),0.5); printf("%.2lf", S); return 0;}
2022-02-14 18:17:57
345
原创 求两点间距离
#include<stdio.h>#include<math.h>int main(){ double x1 = 0, x2 = 0, y1 = 0, y2 = 0, d = 0; scanf("%lf %lf %lf %lf", &x1, &y1, &x2, &y2); d =((x1 - x2)*(x1 - x2)) + ((y1 - y2)*(y1 - y2)); printf("%.2lf", pow(d,0.5)); ret.
2022-02-14 18:17:25
314
原创 求一个数的绝对值
#include<stdio.h>int main(){ float num = 0; scanf("%f", &num); if (num < 0) printf("%.2f", -num); else printf("%.2f", num); return 0;}
2022-02-12 16:26:06
170
原创 圆柱体表面积
#include<stdio.h>#define PI 3.14159int main(){ float r = 0, h = 0; scanf("%f %f", &r, &h); printf("%.2f", 2 * PI * r * r + 2 * PI * r * h); return 0;}
2022-02-12 16:22:50
275
原创 求圆的周长和面积
#include<stdio.h>#define PI 3.14159int main(){ float r = 0; scanf("%f", &r); printf("%.2f %.2f", 2 * PI * r, PI * r * r); return 0;}
2022-02-12 16:18:28
252
原创 求 平均分
已知某位学生的数学、英语和计算机课程的成绩,求该生三门课程的平均分。#include<stdio.h>int main(){ float a = 0, b = 0, c = 0; scanf("%f %f %f", &a, &b, &c); float ave = (a + b + c) / 3; printf("%.2f", ave); return 0;}...
2022-02-12 16:17:21
281
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人