UVA 11498 – Division of Nlogonia

I thought this question was going to be a lot more complicated than it turned out.

import java.io.PrintWriter;
import java.util.Scanner;

/**
 * 
 * @author Sanchit M. Bhatnagar
 * @see http://uhunt.felix-halim.net/id/74004
 * 
 */
public class P11498 {

  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    PrintWriter out = new PrintWriter(System.out);
    int K = 0;
    while ((K = sc.nextInt()) != 0) {
      int N = sc.nextInt();
      int M = sc.nextInt();
      while (K > 0) {
        int X = sc.nextInt();
        int Y = sc.nextInt();
        if (X == N || Y == M) {
          out.println("divisa");
        } else if (X > N) {
          if (Y < M) {
            out.println("SE");
          } else {
            out.println("NE");
          }
        } else {
          if (Y < M) {
            out.println("SO");
          } else {
            out.println("NO");
          }
        }
        K--;
      }
    }
    out.close();
    sc.close();
  }

}

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.