第5个没通过,哪位大佬能帮忙看看哪里出了问题吗

P1089 [NOIP2004 提高组] 津津的储蓄计划

```c #include<stdio.h> #include<string.h> #include<math.h> int a[20]; int main() { int total = 0, money = 0; int t; for (int i = 1; i <= 12; i++) { scanf("%d", &a[i]); } for (int i = 1; i <= 12; i++) { money += 300 - a[i]; if (money < 0) { printf("-%d", i); return 0; } t = money /100; total += t; money -= 100 * t; } printf("%d", (int)(money + total * 120)); return 0; } ``` 兄弟,乘浮点数会向下取整,数比较大可能导致答案错误。
by CodingJellyfish @ 2022-03-11 08:02:58


@[DoctorJellyfish](/user/52381) 谢谢大佬
by qinlei @ 2022-03-11 10:42:31


|