/* * Solution Template for Shopping Spree * * Australian Informatics Olympiad 2024 * * This file is provided to assist with reading and writing of the input * files for the problem. You may modify this file however you wish, or * you may choose not to use this file at all. */ #include /* N is the number of items. */ int N; /* K is the number of coupons. */ int K; /* costs contains the costs of the items. */ int costs[200005]; int answer; int main(void) { FILE *input_file; FILE *output_file; int i; /* Open the input and output files. */ input_file = fopen("shopin.txt", "r"); output_file = fopen("shopout.txt", "w"); /* Read the value of N, K, and the costs from the input file. */ fscanf(input_file, "%d%d", &N, &K); for (i = 0; i < N; i++) { fscanf(input_file, "%d", &costs[i]); } /* * TODO: This is where you should compute your solution. Store the minimum * cost to buy all N items into the variable answer. */ /* Write the answer to the output file. */ fprintf(output_file, "%d\n", answer); /* Finally, close the input/output files. */ fclose(input_file); fclose(output_file); return 0; }