提交记录 #223
提交时间:2024-11-16 10:40:55
语言:c
状态:CompileError
编译情况:编译错误
code.c:30:1: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ at end of input
30 | v
| ^
固定测试点暂不可用
附加测试点暂不可用
M32【期中测验3】商场抽奖
#include <stdio.h>
int main() {
int prices[5];
int totalValue, totalItems;
for (int i = 0; i < 5; i++) {
scanf("%d", &prices[i]);
}
scanf("%d %d", &totalValue, &totalItems);
for (int a = 0; a <= totalItems; a++) {
for (int b = 0; b <= totalItems; b++) {
for (int c = 0; c <= totalItems; c++) {
for (int d = 0; d <= totalItems; d++) {
for (int e = 0; e <= totalItems; e++) {
if ((a + b + c + d + e == totalItems) &&
(a * prices[0] + b * prices[1] + c * prices[2] +
d * prices[3] + e * prices[4] == totalValue)) {
printf("%d,%d,%d,%d,%d\n", a, b, c, d, e);
return 0;
}
}
}
}
}
}
printf("No solution found\n");
return 0;
}
v