题解 | 学生基本信息输入输出
#define _CRT_SECURE_NO_WARNINGS #include <stdio.h> #include<math.h> int main() { long a; float b, c, d; scanf("%ld;%f,%f,%f", &a, &b, &c, &d); b=round(b*100)/100; c=round(c*100)/100; d=round(d*100)/100; printf("The each subject score of No. %ld is %.2f, %.2f, %.2f.", a, b, c, d); return 0; }
直接用%.2f精度不行,遇到0.5进不了位
不知道为什么
之前的人都能过