Skip to content

Instantly share code, notes, and snippets.

@KhaledElshamy
Created July 11, 2016 21:22
Show Gist options
  • Save KhaledElshamy/4b92bc85062c4eb00a7dad0c34bd4eac to your computer and use it in GitHub Desktop.
Save KhaledElshamy/4b92bc85062c4eb00a7dad0c34bd4eac to your computer and use it in GitHub Desktop.
URI ONLINE JUDGE Problem 1181
#include <stdio.h>
int main() {
//URI ONLINE JUDGE Problem 1181
char a;
int i, j, f;
float s = 0.0, n;
scanf("%d ", &f);
scanf("%c", &a);
for (i = 0; i < 112; i++) {
for (j = 0; j < 12; j++) {
scanf("%f", &n);
if (i == f) s += n;
}
}
if (a == 'S') printf("%.1f\n", s);
else printf("%.1f\n", s / 12);
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment