Изменения рейтингов за последние раунды временно удалены. Скоро они будут возвращены. ×

Блог пользователя abhimanyu_sahrawat

Автор abhimanyu_sahrawat, история, 2 года назад, По-английски

import java.util.*; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int t = sc.nextInt(); while (t-- > 0) { double x1=sc.nextDouble(); double p1= sc.nextDouble(); double x2= sc.nextDouble(); double p2=sc.nextDouble(); double mulx1=0; double mulx2=0;

if (x1==0){
           x1=1;
       } else {
           x1=x1;
       }
       if (x2==0){
           x2=1;
       }else {
           x2=x2;
       }
       if (p1>0){
            mulx1=x1*Math.pow(10,p1);
        }else {
            mulx1=x1*1;

        }

        if (p2>0){
            mulx2=x2*Math.pow(10,p2);
        }else {
            mulx2=x2*1;
        }
        if (mulx1>mulx2)
            System.out.println(">");
        else if (mulx1<mulx2)
            System.out.println("<");
        else if (mulx1== mulx2)
            System.out.println("=");

    }


}

}

Полный текст и комментарии »

  • Проголосовать: нравится
  • -17
  • Проголосовать: не нравится

Автор abhimanyu_sahrawat, история, 2 года назад, По-английски

You are playing a variation on the chess game on board with N×N squares. Rows and columns are numbered from 1 to N. You also have Q queens. Let us remind that the queen is a piece in chess that can move any number of squares horizontally, vertically, or diagonally.

You will be placing the queens on the board. The only condition is that no two queens can attack each other. Before each placement, you have to determine if placing a queen in this particular place is safe from the already placed queens. If the place is not safe, you don't put the queen at that place and just continue checking new positions.

Input The first line contains two integers N and Q (1≤N,Q≤100000), the size of the board and the number of queries respectively.

The next Q lines contain two integers Xi and Yi (1≤Xi,Yi≤N) – the position where we want to place the queen. We will never try to put a queen at the same place that we already tried to put a queen before, so all pairs (Xi,Yi) will be different.

Output For i-th query, output YES if placing the i-th queen was successful (it didn't cause any two queens attacking each other) or NO otherwise.\

((the question is form eerichto's bootcamp " queens attack").

Полный текст и комментарии »

  • Проголосовать: нравится
  • -5
  • Проголосовать: не нравится