結果

問題 No.550 夏休みの思い出(1)
ユーザー kotamanegikotamanegi
提出日時 2017-07-28 23:07:38
言語 C++11
(gcc 11.4.0)
結果
WA  
実行時間 -
コード長 1,602 bytes
コンパイル時間 1,027 ms
コンパイル使用メモリ 102,860 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-04-18 11:32:52
合計ジャッジ時間 10,078 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 AC 136 ms
5,376 KB
testcase_02 AC 133 ms
5,376 KB
testcase_03 AC 129 ms
5,376 KB
testcase_04 AC 129 ms
5,376 KB
testcase_05 AC 141 ms
5,376 KB
testcase_06 AC 132 ms
5,376 KB
testcase_07 AC 132 ms
5,376 KB
testcase_08 AC 133 ms
5,376 KB
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 AC 130 ms
5,376 KB
testcase_23 AC 127 ms
5,376 KB
testcase_24 AC 130 ms
5,376 KB
testcase_25 AC 133 ms
5,376 KB
testcase_26 AC 134 ms
5,376 KB
testcase_27 AC 141 ms
5,376 KB
testcase_28 AC 137 ms
5,376 KB
testcase_29 AC 136 ms
5,376 KB
testcase_30 AC 139 ms
5,376 KB
testcase_31 WA -
testcase_32 WA -
testcase_33 WA -
testcase_34 WA -
testcase_35 WA -
testcase_36 WA -
testcase_37 WA -
testcase_38 WA -
testcase_39 WA -
testcase_40 AC 135 ms
5,376 KB
testcase_41 AC 133 ms
5,376 KB
testcase_42 AC 136 ms
5,376 KB
testcase_43 AC 130 ms
5,376 KB
testcase_44 AC 128 ms
5,376 KB
testcase_45 AC 133 ms
5,376 KB
testcase_46 AC 131 ms
5,376 KB
testcase_47 AC 129 ms
5,376 KB
testcase_48 AC 140 ms
5,376 KB
testcase_49 AC 130 ms
5,376 KB
testcase_50 AC 131 ms
5,376 KB
testcase_51 AC 132 ms
5,376 KB
testcase_52 WA -
testcase_53 WA -
testcase_54 WA -
testcase_55 WA -
testcase_56 WA -
testcase_57 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

#define  _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
#include <algorithm>
#include <utility>
#include <functional>
#include <cstring>
#include <queue>
#include <stack>
#include <math.h>
#include <iterator>
#include <vector>
#include <string>
#include <set>
#include <math.h>
#include <iostream> 
#include <random>
#include<map>
#include <iomanip>
#include <time.h>
#include <stdlib.h>
#include <list>
#include <typeinfo>
#include <list>
#include <set>
#include<fstream>
using namespace std;
#define eps 0.000000001
#define LONG_INF 10000000000000000
#define GOLD 1.61803398874989484820458
#define MAX_MOD 1000000007
#define f(n) for(int i=0;i<n;++i)
#define REP(i,n) for(long long i = 0;i < n;++i)
#define double long double
double a, b, c;
double calc_f(double x) {
	double ans = x;
	ans += a;
	ans *= x;
	ans += b;
	ans *= x;
	ans += c;
	return ans;
}
double calc_fd(double x) {
	double ans = 3 * x;
	ans += 2 * a;
	ans *= x;
	ans += b;
	return ans;
}
int main() {
#define int long long
	cin >> a >> b >> c;
	double n = 1000000000;
failed:;
	for (int i = 0;i < 10000000;++i) {
		n = n - (calc_f(n) / calc_fd(n));
	}
	//nは解の一つ
	if (roundl(n) == 0) {
		n = -1000000000;
		goto failed;
	}
	vector<double> ans;
	ans.push_back(roundl(n));
	double q = 1;
	double w = a+ans[0];
	double h = -1 * (c / ans[0]);
	double topper = -1 * w + sqrt(w*w - 4 * q*h);
	topper /= 2 * q;
	ans.push_back(roundl(topper));
	topper = -1 * w - sqrt(w*w - 4 * q*h);
	topper /= 2 * q;
	ans.push_back(roundl(topper));
	sort(ans.begin(), ans.end());
	cout << ans[0] << " " << ans[1] << " " << ans[2] << endl;
	return 0;
}
0