#include <stdio.h>
int main() {
char line[100];
int num_tests, n, m, x, y;
char h, v;
while (1) {
fgets(line, 100, stdin);
sscanf(line, "%d", &num_tests);
if (num_tests == 0) {
return 0;
}
fgets(line, 100, stdin);
sscanf(line, "%d %d", &n, &m);
for (int i = 0; i < num_tests; ++i) {
fgets(line, 100, stdin);
sscanf(line, "%d %d", &x, &y);
if (x == n || y == m) {
printf("divisa\n");
continue;
}
if (x > n) {
h = 'E';
}
else {
h = 'O';
}
if (y > m) {
v = 'N';
}
else {
v = 'S';
}
printf("%c%c\n", v, h);
}
}
return 0;
}
Thursday, August 2, 2012
11498: Division of Nlogonia
Thought about reviving this blog. I visited UVa Online Judge today and they have a lot of new problems since I last visited it. I tried looking for an easy problem and this is what I found. Here is a sample C++ code solution that got accepted:
Labels:
11498,
algorithm,
C++,
code,
Division of Nlogonia,
solution,
UVA Online Judge
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment