Cornhusker

Question

Solution

Idea

This is another math problem testing data type and basic I/O. Nothing much to talk about.

Code

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

int main()
{
  int sum = 0;
  for (int i = 0; i < 5; i += 1)
  {
    int w = 0;
    int l = 0;
    scanf("%d %d", &w, &l);
    sum += w * l;
  }

  int avg = sum / 5;
  
  int n;
  int kwf;
  scanf("%d %d", &n, &kwf);

  printf("%d\n", avg * n / kwf);
}

Last updated