結果

問題 No.2555 Intriguing Triangle
ユーザー laneguelanegue
提出日時 2023-12-03 02:59:15
言語 D
(dmd 2.106.1)
結果
AC  
実行時間 26 ms / 2,000 ms
コード長 866 bytes
コンパイル時間 3,596 ms
コンパイル使用メモリ 97,024 KB
実行使用メモリ 6,676 KB
最終ジャッジ日時 2023-12-03 02:59:20
合計ジャッジ時間 4,599 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

import std.stdio;
import std.conv;
import std.string;
import std.bigint;

void main(){
  auto a = readln.chomp.to!long;
  auto b = readln.chomp.to!long;
  auto c = readln.chomp.to!long;
  for(long x = 1; x + a < b + c; x++){
    for(long y = 1; x + y + a < b + c; y++){
      if(solve(a, b, c, x, y)){
        writeln("Yes");
        return;
      }
    }
  }
  writeln("No");
}

bool solve(long a, long b, long c, long x, long y){
  long l = a + x + y;
  if(l >= b + c) return false;
  if(b >= c + l) return false;
  if(c >= b + l) return false;
  long s = l ^^ 2 + b ^^ 2 - c ^^ 2;
  long t = l ^^ 2 + c ^^ 2 - b ^^ 2;
  BigInt left = l * c ^^ 2 + l * y ^^ 2 - y * t;
  left *= (2 * b ^^ 2 * l - x * s) ^^ 2;
  left *= c ^^ 2;
  BigInt right = l * b ^^ 2 + l * x ^^ 2 - x * s;
  right *= (2 * c ^^ 2 * l - y * t) ^^ 2;
  right *= b ^^ 2;
  return left == right;
}
0