結果

問題 No.2555 Intriguing Triangle
ユーザー momoyuumomoyuu
提出日時 2023-12-03 00:28:40
言語 C++23
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 1,005 bytes
コンパイル時間 1,151 ms
コンパイル使用メモリ 109,500 KB
実行使用メモリ 6,676 KB
最終ジャッジ日時 2023-12-03 00:28:42
合計ジャッジ時間 2,640 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

#include<algorithm>
#include<iostream>
#include<vector>

using namespace std;
using ll = long long;

#include<math.h>
int main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);

    int a,b,c;
    cin>>a>>b>>c;
    
    const int mx = 200;
    bool fn = false;

    for(int i = 1;i<=mx;i++){
        for(int j = 1;j<=mx;j++){
            int all = a + i + j;
            if(b+c<=all) continue;
            if(b+all<=c) continue;
            if(c+all<=b) continue;
            double cb = (double)(b * b + all * all - c * c) / (2 * b * all);
            double cc = (double)(c*c+all*all-b*b)/(2*c*all);
            double ad = sqrt(b*b+i*i-2*b*i*cb);
            double ae = sqrt(c*c+j*j-2*c*j*cc);
            double a1 = (double)(b*b+ad*ad-i*i)/(2*b*ad);
            double a2 = (double)(c*c+ae*ae-j*j)/(2*c*ae);
            if(abs(a1-a2)<1e-9){
                fn = true;
                cout<<i<<" "<<j<<endl;
            }
        }
    }
    if(fn) cout<<"Yes\n";
    else cout<<"No\n";

}


0