結果

問題 No.955 ax^2+bx+c=0
ユーザー mmn15277198mmn15277198
提出日時 2021-04-12 20:02:06
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 2,783 bytes
コンパイル時間 851 ms
コンパイル使用メモリ 90,084 KB
実行使用メモリ 6,580 KB
最終ジャッジ日時 2023-09-11 01:54:11
合計ジャッジ時間 5,022 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 AC 4 ms
6,272 KB
testcase_02 AC 4 ms
6,300 KB
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
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 WA -
testcase_18 WA -
testcase_19 WA -
testcase_20 WA -
testcase_21 WA -
testcase_22 WA -
testcase_23 WA -
testcase_24 AC 4 ms
6,488 KB
testcase_25 AC 4 ms
6,448 KB
testcase_26 AC 4 ms
6,256 KB
testcase_27 AC 4 ms
6,420 KB
testcase_28 AC 4 ms
6,244 KB
testcase_29 AC 4 ms
6,424 KB
testcase_30 AC 4 ms
6,268 KB
testcase_31 AC 4 ms
6,356 KB
testcase_32 AC 4 ms
6,428 KB
testcase_33 AC 5 ms
6,480 KB
testcase_34 WA -
testcase_35 WA -
testcase_36 WA -
testcase_37 WA -
testcase_38 WA -
testcase_39 WA -
testcase_40 WA -
testcase_41 WA -
testcase_42 WA -
testcase_43 WA -
testcase_44 WA -
testcase_45 WA -
testcase_46 WA -
testcase_47 WA -
testcase_48 WA -
testcase_49 WA -
testcase_50 WA -
testcase_51 WA -
testcase_52 WA -
testcase_53 WA -
testcase_54 WA -
testcase_55 WA -
testcase_56 WA -
testcase_57 WA -
testcase_58 WA -
testcase_59 WA -
testcase_60 AC 4 ms
6,360 KB
testcase_61 AC 4 ms
6,240 KB
testcase_62 WA -
testcase_63 WA -
testcase_64 AC 4 ms
6,424 KB
testcase_65 WA -
testcase_66 AC 4 ms
6,264 KB
testcase_67 WA -
testcase_68 AC 4 ms
6,352 KB
testcase_69 WA -
testcase_70 WA -
testcase_71 AC 4 ms
6,252 KB
testcase_72 AC 4 ms
6,420 KB
testcase_73 WA -
testcase_74 WA -
testcase_75 AC 5 ms
6,428 KB
testcase_76 AC 4 ms
6,484 KB
testcase_77 WA -
testcase_78 WA -
testcase_79 WA -
testcase_80 AC 4 ms
6,376 KB
testcase_81 WA -
testcase_82 AC 4 ms
6,240 KB
testcase_83 AC 4 ms
6,476 KB
testcase_84 AC 4 ms
6,264 KB
testcase_85 AC 4 ms
6,352 KB
testcase_86 AC 4 ms
6,432 KB
testcase_87 AC 4 ms
6,476 KB
testcase_88 AC 4 ms
6,420 KB
testcase_89 AC 4 ms
6,256 KB
testcase_90 AC 4 ms
6,300 KB
testcase_91 AC 4 ms
6,480 KB
testcase_92 WA -
testcase_93 WA -
testcase_94 AC 4 ms
6,308 KB
testcase_95 AC 5 ms
6,484 KB
testcase_96 AC 4 ms
6,256 KB
testcase_97 AC 4 ms
6,492 KB
testcase_98 AC 4 ms
6,252 KB
testcase_99 AC 4 ms
6,532 KB
testcase_100 WA -
testcase_101 AC 4 ms
6,548 KB
testcase_102 WA -
testcase_103 WA -
testcase_104 WA -
testcase_105 WA -
testcase_106 WA -
testcase_107 WA -
testcase_108 WA -
testcase_109 WA -
testcase_110 WA -
testcase_111 WA -
testcase_112 WA -
testcase_113 WA -
testcase_114 WA -
testcase_115 WA -
testcase_116 WA -
testcase_117 WA -
testcase_118 WA -
testcase_119 WA -
testcase_120 WA -
testcase_121 WA -
testcase_122 WA -
testcase_123 WA -
testcase_124 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <vector>
#include <functional>
#include <algorithm>
#include <map>
#include <cstdio>
#include <cmath>
#include <iomanip>

using namespace std;

#define rep(i,n) for (int i = 0; i < (n); i++)
#define vi vector<int>
#define vll vector<long long>
#define vb vector<bool>
#define all(x) x.begin() , x.end()
#define pb push_back()
#define eb emplace_back()
#define chmax(x,y) (x) = max((x) , (y))
#define chmix(x,y) (x) = mix((x) , (y))

typedef long long ll;
typedef long double ld;

//const int MOD = int(1e9) + 7;
//const int MOD = 998244353;
const ll MOD = ll(1e9) + 7;
//const ll MOD = 998244353;
const ld PI = 3.1415926535897932384626;
const int INF = 1001001001;
const ll LINF = 1001001001001001001;
const int MX = 220000;

ll gcd (ll a , ll b) { if (a < b) swap(a , b); if (a % b == 0) return b; else return gcd(b , a % b); }
ll lcm (ll a , ll b) { return a / gcd(a , b) * b; }
ll lin() { ll x; scanf("%lld" , &x); return x; }
int in() { int x; scanf("%d" , &x); return x; }

void io_setup() {
    cout << fixed << setprecision(30);
}

ll modpow (ll x , ll p) {
    ll ret = 1;
    while (p) {
        if (p % 2 == 1) {
            ret *= x;
            ret %= MOD;
        }
        x *= x;
        x %= MOD;
        p /= 2;
    }
    return ret;
}

ll moddiv (ll a , ll b) {
    return a * modpow(b , MOD - 2) % MOD;
}

ll modsub (ll a , ll b) {
    if (a >= b) return (a - b) % MOD;
    else return (MOD - a + b);
}

vll fact(MX);
vll factinv(MX);
void init_fact () {
    fact[0] = 1;
    for (int i = 1; i < MX; i++) {
        fact[i] = 1LL * i * fact[i - 1] % MOD;
    }
    for (int i = 0; i < MX; i++) {
        factinv[i] = modpow(fact[i] , MOD - 2);
    }
}

ll nCk (ll n , ll k) {
    return ((fact[n] * factinv[k] % MOD) * factinv[n - k] % MOD);
}

bool is_prime (int x) {
    if (x == 2 || x == 3 || x == 5 || x == 7) {
        return true;
    }
    for (ll i = 2; i*i <= x; i++) {
        if (x % i == 0) {
            return false;
        }
    }
    return true;
}

vb prime_table(MX , true);
void init_prime() {
    for (int i = 2; i < MX; i++) {
        for (int j = i + i; j < MX; j += i) {
            prime_table[j] = false;
        }
    }
    return;
}

void solve () {
    ld a , b , c;
    cin >> a >> b >> c;
    ld d = b * b - 4 * a * c;
    if (d < 0) {
        cout << 0 << endl;
    }else if (d == 0) {
        cout << 1 << endl;
        cout << (-b) / (ld)2 / a << endl;
    } else {
        cout << 2 << endl;
        ld ans1 = ((-b) + sqrt(d)) / (ld)2 / a;
        ld ans2 = ((-b) - sqrt(d)) / (ld)2 / a;
        if (ans1 > ans2) swap(ans1 , ans2);
        cout << ans1 << " " << ans2 << endl;
    }
    return;
}

int main() {
    io_setup();
    //init_fact();
    //init_prime();
    solve();
    return 0;
}





0