2026 年 4 月 18 日,如果没有 `round` 函数手动四舍五入的话,至少有一组用例会通不过。
#include <stdio.h>
#include <math.h>
int main() {
int i;
float a, b, c;
scanf("%d;%f,%f,%f", &i, &a, &b, &c);
a = round(a * 100) / 100;
b = round(b * 100) / 100;
c = round(c * 100) / 100;
printf("The each subject score of No. %d is %.2f, %.2f, %.2f.\n", i, a, b, c);
return 0;
}

京公网安备 11010502036488号