結果
| 問題 |
No.2555 Intriguing Triangle
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2023-12-01 21:35:45 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 2 ms / 2,000 ms |
| コード長 | 794 bytes |
| コンパイル時間 | 1,759 ms |
| コンパイル使用メモリ | 168,272 KB |
| 実行使用メモリ | 5,376 KB |
| 最終ジャッジ日時 | 2024-09-26 15:55:17 |
| 合計ジャッジ時間 | 2,878 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 28 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
int main(){
int de;
cin >> de;
int ab;
cin >> ab;
int ac;
cin >> ac;
bool ans=false;
for(int bd=1;bd+de<ab+ac;bd++){
for(int ec=1;bd+de+ec<ab+ac;ec++){//三角形として存在できる範囲
int bc=bd+de+ec;
if(ab>=ac+bc || ac>=ab+bc){//三角形として存在できない
continue;
}
//余弦定理
double cosB=(double)(ab*ab+bc*bc-ac*ac)/(2*ab*bc);
double ad2=ab*ab+bd*bd-2*ab*bd*cosB;
double cosBAD=(double)(ab*ab+ad2-bd*bd)/(2*ab*sqrt(ad2));
double cosC=(double)(ac*ac+bc*bc-ab*ab)/(2*ac*bc);
double ae2=ac*ac+ec*ec-2*ac*ec*cosC;
double cosCAE=(double)(ac*ac+ae2-ec*ec)/(2*ac*sqrt(ae2));
if(abs(cosBAD-cosCAE)<1e-6){
ans=true;
}
}
}
cout << (ans?"Yes":"No") << endl;
}