/* * Solution Template for Beautiful Buildings * * 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 buildings. */ int N; /* * H contains the heights on the buildings. Note that here the buildings are * numbered starting from 0. */ int H[100005]; int answer; int main(void) { /* Open the input and output files. */ FILE *input_file = fopen("buildin.txt", "r"); FILE *output_file = fopen("buildout.txt", "w"); /* Read the value of N. */ fscanf(input_file, "%d", &N); /* Read the heights. */ for (int i = 0; i < N; i++) { fscanf(input_file, "%d", &H[i]); } /* * TODO: This is where you should compute your solution. Store the minimum * ugliness you can achieve 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; }