QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#596442#9168. Square Locator336699go#RE 165ms57120kbJava111.4kb2024-09-28 15:47:492024-09-28 15:47:50

Judging History

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

  • [2024-09-28 15:47:50]
  • 评测
  • 测评结果:RE
  • 用时:165ms
  • 内存:57120kb
  • [2024-09-28 15:47:49]
  • 提交

answer

import java.io.*;
import java.util.*;

public class Main {
	public static class Point {
		public long x, y;

		public Point(long x, long y) {
			this.x = x;
			this.y = y;
		}
	}

	public static void main(String[] args) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		StringTokenizer st = new StringTokenizer(br.readLine());
		long A = Integer.parseInt(st.nextToken());
		long B = Integer.parseInt(st.nextToken());
		long C = Integer.parseInt(st.nextToken());
		long D = Integer.parseInt(st.nextToken());

		Point pA = new Point(0, (long) Math.sqrt(A));
		long temp = Math.abs((D - B) / (2 * pA.y));
		Point pC = new Point(temp, (long) Math.sqrt(Math.abs(C - temp * temp)));
		long sideSqr = ((pA.x - pC.x) * (pA.x - pC.x) + (pA.y - pC.y) * (pA.y - pC.y)) / 2;
		long x = (- temp + (long) Math.sqrt(temp * temp - 2 * (temp * temp - sideSqr))) / 2;
		
		Point p1, p2;
		
		if (pC.y < pA.y) {
			p1 = new Point(temp + x, pA.y - x);
			p2 = new Point(-x, pA.y - temp - x);
		} else {
			p1 = new Point(temp + x, pA.y + x);
			p2 = new Point(-x, pA.y + temp + x);
		}
		
		Point pB, pD;
		
		if (p1.x * p1.x + p1.y * p1.y == B) {
			pB = p1;
			pD = p2;
		} else {
			pB = p2;
			pD = p1;
		}
		
		System.out.println(pA.y + " " + pB.x  + " " + pB.y  + " " + pC.x  + " " + pC.y + " " + pD.x + " " + pD.y);
		br.close();
	}
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 147ms
memory: 57120kb

input:

36 5 10 41

output:

6 -1 2 3 1 4 5

result:

ok Answer is correct

Test #2:

score: 0
Accepted
time: 165ms
memory: 55456kb

input:

1 1 1 1

output:

1 0 1 0 1 0 1

result:

ok Answer is correct

Test #3:

score: -100
Runtime Error

input:

1000000000000000000 1000000000000000000 1000000000000000000 1000000000000000000

output:


result: