#include <stdio.h>
#define MAX_DAYS 4
#define NUM_SPOTS 4
typedef struct {
char name[20];
int time;
int score;
} Spot;
void selectOptimalSpots(Spot spots[], int days) {
int remainingDays = days;
int i;
for ( i= 0; i < NUM_SPOTS; ++i) {
if (spots[i].time <= remainingDays) {
printf("拜访 %s\n", spots[i].name);
remainingDays -= spots[i].time;
}
}
}
int main() {
Spot spots[NUM_SPOTS] = {
{"故宫", 1, 7},
{"颐和园", 2, 8},
{"长城", 3, 9},
{"天坛", 1, 6},
};
printf("以下是去北京景点的建议:\n");
selectOptimalSpots(spots, MAX_DAYS);
return 0;
}