Cosmic Path Optimization

Question

Solution

Idea

This is a huge funny question, don't feel panic because of the physics content in the question. It is nothing but a simple math problem about getting the average, nothing to talk about.

Code

https://github.com/mendax1234/Coding-Problems/blob/main/kattis/cosmicpathoptimization/cosmicpathoptimization.c
#include <stdio.h>

int main() {
  int n = 0;
  scanf("%d", &n);
  
  int sum = 0;
  for (int i = 0; i < n; i += 1)
  {
    int t = 0;
    scanf("%d", &t);
    sum += t;
  }

  printf("%d\n", sum / n);
}

Last updated