QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#298380#6246. مربع مارپیچmahdimalverdiWA 103ms57244kbJava111.9kb2024-01-06 05:18:522024-01-06 05:18:52

Judging History

你现在查看的是最新测评结果

  • [2024-01-06 05:18:52]
  • 评测
  • 测评结果:WA
  • 用时:103ms
  • 内存:57244kb
  • [2024-01-06 05:18:52]
  • 提交

answer


import java.util.Scanner;

class Codechef {
    public static void main(String[] args) throws java.lang.Exception {
        Scanner sc = new Scanner(System.in);

        int n = sc.nextInt();
        int s = sc.nextInt();
        int d = sc.nextInt();


        int x1 = 0, x2 =0, y1 = 0, y2 = 0;

        int counter = 0;
        for (int i = 0; i < n / 2.0; i++) {
            for (int j = i; j < n - i; j++) {
                counter++;
                if (counter == s) {
                    x1 = i;
                    y1 = j;
                }
                if (counter == d) {
                    x2 = i;
                    y2 = j;
                }
            }
            for (int j = i+1; j < n - i; j++) {
                counter++;
                if (counter == s) {
                    x1 = j;
                    y1 = n - i * 2 - 1;
                }
                if (counter == d) {
                    x2 = j;
                    y2 = n - i * 2 - 1;
                }
            }
            for (int j = n - i - 2; j > i-1; j--) {
                counter++;
                if (counter == s) {
                    x1 = n - i - 1;
                    y1 = j;
                }
                if (counter == d) {
                    x2 = n - i  - 1;
                    y2 = j;
                }
            }
            for (int j = n - i - 2; j > i; j--) {
                counter++;
                if (counter == s) {
                    x1 = j;
                    y1 = i;
                }
                if (counter == d) {
                    x2 = j;
                    y2 = i;
                }
            }
        }

        if(y1 != y2){
            System.out.printf(y1 > y2 ? "%d L\n" : "%d R\n", Math.abs(y1-y2));
        }
        if(x1 != x2){
            System.out.printf(x1 > x2 ? "%d D\n" : "%d U\n", Math.abs(x1-x2));
        }
    }
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 89ms
memory: 55628kb

input:

5 1 25

output:

2 R
2 U

result:

ok 2 lines

Test #2:

score: 0
Accepted
time: 88ms
memory: 56608kb

input:

5 3 22

output:

3 U

result:

ok single line: '3 U'

Test #3:

score: 0
Accepted
time: 98ms
memory: 57244kb

input:

6 15 22

output:

1 R
4 D

result:

ok 2 lines

Test #4:

score: -100
Wrong Answer
time: 103ms
memory: 54640kb

input:

1376 1845264 1658394

output:

468 R
284 U

result:

wrong answer 1st lines differ - expected: '110 L', found: '468 R'