結果

問題 No.550 夏休みの思い出(1)
ユーザー mikan765mikan765
提出日時 2017-09-05 18:58:06
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
TLE  
実行時間 -
コード長 1,310 bytes
コンパイル時間 690 ms
コンパイル使用メモリ 78,248 KB
実行使用メモリ 8,760 KB
最終ジャッジ日時 2023-08-06 19:24:35
合計ジャッジ時間 14,001 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1,398 ms
8,760 KB
testcase_01 AC 5 ms
4,376 KB
testcase_02 AC 5 ms
4,376 KB
testcase_03 AC 4 ms
4,376 KB
testcase_04 AC 5 ms
4,380 KB
testcase_05 AC 5 ms
4,380 KB
testcase_06 AC 4 ms
4,380 KB
testcase_07 AC 5 ms
4,380 KB
testcase_08 AC 5 ms
4,376 KB
testcase_09 AC 1,399 ms
4,376 KB
testcase_10 AC 1,406 ms
4,376 KB
testcase_11 AC 1,410 ms
4,380 KB
testcase_12 AC 1,408 ms
4,380 KB
testcase_13 AC 467 ms
4,380 KB
testcase_14 AC 466 ms
4,380 KB
testcase_15 TLE -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
testcase_20 -- -
testcase_21 -- -
testcase_22 -- -
testcase_23 -- -
testcase_24 -- -
testcase_25 -- -
testcase_26 -- -
testcase_27 -- -
testcase_28 -- -
testcase_29 -- -
testcase_30 -- -
testcase_31 -- -
testcase_32 -- -
testcase_33 -- -
testcase_34 -- -
testcase_35 -- -
testcase_36 -- -
testcase_37 -- -
testcase_38 -- -
testcase_39 -- -
testcase_40 -- -
testcase_41 -- -
testcase_42 -- -
testcase_43 -- -
testcase_44 -- -
testcase_45 -- -
testcase_46 -- -
testcase_47 -- -
testcase_48 -- -
testcase_49 -- -
testcase_50 -- -
testcase_51 -- -
testcase_52 -- -
testcase_53 -- -
testcase_54 -- -
testcase_55 -- -
testcase_56 -- -
testcase_57 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <math.h> 
#define INF 999999999
#define rep(i, n) for(int i = 0;i < n;i++)
#define ll long long


using namespace std;
int main(void){
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    ll a,b,c;
    ll ans1;
    cin >> a >> b >> c;
    ll i = 0;
    while(true){
        if(i*i*i+a*i*i+b*i+c==0){
            ans1=i;
            break;
        }
        if(-i*i*i+a*i*i-b*i+c==0){
            ans1=-i;
            break;
        }
        i++;
    }
    if(ans1==0){
        a = 1;
    }else{
        a = a+ans1;
        b = b+a*ans1;
    }
    ll ans2;
    ll ans3;
    i=0;
    while(true){
        if(i*(-a-i)==b){
            if(i<-a-i){
                ans2=i;
                ans3=-a-i;
            }else{
                ans2=-a-i;
                ans3=i;
            }
            break;
        }
        if(-i*(-a+i)==b){
            if(-i<-a+i){
                ans2=-i;
                ans3=-a+i;
            }else{
                ans2=-a+i;
                ans3=-i;
            }
            break;
        }
        i++;
    }
    if(ans1<ans2){
        cout << ans1 <<" "<< ans2 <<" "<< ans3 << endl;
    }else if(ans1<ans3){
        cout << ans2 <<" "<< ans1 <<" "<< ans3 << endl;
    }else{
        cout << ans2 <<" "<< ans3 <<" "<< ans1 << endl;
    }
}
0