Skip to content

Instantly share code, notes, and snippets.

@KhaledElshamy
Last active July 11, 2016 21:31
Show Gist options
  • Save KhaledElshamy/b26a38effb4a054b9d4000f4f9526acd to your computer and use it in GitHub Desktop.
Save KhaledElshamy/b26a38effb4a054b9d4000f4f9526acd to your computer and use it in GitHub Desktop.
URI ONLINE JUDGE Problenm 1189
#include <stdio.h>
#define Num_column 12
#define Num_row 12
int main()
{
//URI ONLINE JUDGE Problenm 1189
double b[Num_row][Num_column],p,sum = 0.0;
int i, j;
char c;
scanf("%c",&c);
for (i = 0;i < 6;i++)
{
for (j = 0;j < 12;j++)
{
scanf("%lf", &b[i][j]);
if (j < i)
sum += b[i][j];
}
}
for (i = 6;i < 12;i++)
{
for (j = 0;j < 12;j++)
{
scanf("%lf", &b[i][j]);
if (j <= (Num_column - (i + 2)))
sum += b[i][j];
}
}
if (c == 'S')
printf("%.1lf\n", sum);
else
printf("%.1lf\n", sum / 30);
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment