Skip to content

Instantly share code, notes, and snippets.

@KhaledElshamy
Created July 11, 2016 21:31
Show Gist options
  • Select an option

  • Save KhaledElshamy/3e55eb500b8ae23047144004b34a888c to your computer and use it in GitHub Desktop.

Select an option

Save KhaledElshamy/3e55eb500b8ae23047144004b34a888c to your computer and use it in GitHub Desktop.
URI ONLINE JUDGE Problem 1190
#include <stdio.h>
#define Num_column 12
#define Num_row 12
int main()
{
//URI ONLINE JUDGE Problem 1190
double b[Num_row][Num_column],p,sum = 0.0;
int i, j;
char c;
scanf("%c",&c);
for (i = 0;i < 12;i++)
{
for (j = 0;j < 12;j++)
scanf("%lf", &b[i][j]);
}
for (i = 11;i >=6;i--)
{
for (j = 11;j >= 0;j--)
{
if (j > i)
sum += b[i][j];
}
}
for (i = 5;i >= 0;i--)
{
for (j = 11;j >= 0;j--)
{
if (j >= (Num_column - i))
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