結果

問題 No.55 正方形を描くだけの簡単なお仕事です。
ユーザー kou_kkkkou_kkk
提出日時 2023-09-10 14:17:52
言語 Nim
(2.0.2)
結果
AC  
実行時間 2 ms / 5,000 ms
コード長 724 bytes
コンパイル時間 4,607 ms
コンパイル使用メモリ 70,864 KB
実行使用メモリ 4,380 KB
最終ジャッジ日時 2023-09-10 14:18:01
合計ジャッジ時間 5,882 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,376 KB
testcase_01 AC 1 ms
4,376 KB
testcase_02 AC 2 ms
4,376 KB
testcase_03 AC 1 ms
4,376 KB
testcase_04 AC 2 ms
4,380 KB
testcase_05 AC 2 ms
4,376 KB
testcase_06 AC 2 ms
4,380 KB
testcase_07 AC 2 ms
4,380 KB
testcase_08 AC 2 ms
4,380 KB
testcase_09 AC 1 ms
4,376 KB
testcase_10 AC 2 ms
4,380 KB
testcase_11 AC 2 ms
4,376 KB
testcase_12 AC 1 ms
4,376 KB
testcase_13 AC 2 ms
4,380 KB
testcase_14 AC 2 ms
4,380 KB
testcase_15 AC 2 ms
4,376 KB
testcase_16 AC 2 ms
4,376 KB
testcase_17 AC 1 ms
4,376 KB
testcase_18 AC 2 ms
4,376 KB
testcase_19 AC 2 ms
4,376 KB
testcase_20 AC 2 ms
4,376 KB
testcase_21 AC 2 ms
4,376 KB
testcase_22 AC 2 ms
4,376 KB
testcase_23 AC 1 ms
4,376 KB
testcase_24 AC 2 ms
4,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import math, sequtils, strutils

var x1, x2, x3, y1, y2, y3: float
(x1, y1, x2, y2, x3, y3) = stdin.readLine.split.map parseFloat

proc d(a, b: float): float = sqrt a^2 + b^2

let
  d12 = d(x1 - x2, y1 - y2)
  d13 = d(x1 - x3, y1 - y3)
  d23 = d(x2 - x3, y2 - y3)
  list = [d12, d13, d23]
  maxD = max list

if d13 == maxD:
  swap(x2, x3)
  swap(y2, y3)
if d23 == maxD:
  swap(x1, x3)
  swap(y1, y3)
if x1 > x2:
  swap(x1, x2)
  swap(y1, y2)

let
  dx = (x2 - x1)
  dy = (y2 - y1)
  cx = x1 + dx / 2
  cy = y1 + dy / 2
  xa = cx - dy / 2
  ya = cy + dx / 2
  xb = cx + dy / 2
  yb = cy - dx / 2

if x3 == xa and y3 == ya:
  echo xb.int," ",yb.int
  quit()
if x3 == xb and y3 == yb:
  echo xa.int," ",ya.int
  quit()

echo -1
0