/* * Solution Template for Spaceship Shuffle * * Australian Informatics Olympiad 2022 * * 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 cabins. */ int N; /* * A contains the initial number of crewmates in each cabin. Note that here the * cabins are numbered starting from 0. */ long long A[100005]; /* * B contains the desired number of crewmates in each cabin. Note that here the * cabins are numbered starting from 0. */ long long B[100005]; long long answer; int main(void) { /* Open the input and output files. */ FILE *input_file = fopen("spacein.txt", "r"); FILE *output_file = fopen("spaceout.txt", "w"); /* Read the value of N. */ fscanf(input_file, "%d", &N); /* Read the values of A and B. */ for (int i = 0; i < N; i++) { fscanf(input_file, "%lld", &A[i]); } for (int i = 0; i < N; i++) { fscanf(input_file, "%lld", &B[i]); } /* * TODO: This is where you should compute your solution. Store the fewest * dollars you must pay before you can depart into the variable answer. */ /* * Please note that the answer may exceed the maximum value * that can be stored in an "int" integer type. * Because of this, you should use the "long long" integer type * instead of "int" when computing your solution. */ /* Write the answer to the output file. */ fprintf(output_file, "%lld\n", answer); /* Finally, close the input/output files. */ fclose(input_file); fclose(output_file); return 0; }