結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 8 ms
8,576 KB
testcase_01 AC 8 ms
5,376 KB
testcase_02 AC 8 ms
5,376 KB
testcase_03 AC 8 ms
5,376 KB
testcase_04 AC 8 ms
5,376 KB
testcase_05 AC 8 ms
5,376 KB
testcase_06 AC 8 ms
5,376 KB
testcase_07 AC 8 ms
5,376 KB
testcase_08 AC 8 ms
5,376 KB
testcase_09 AC 8 ms
5,376 KB
testcase_10 AC 8 ms
5,376 KB
testcase_11 AC 8 ms
5,376 KB
testcase_12 AC 7 ms
5,376 KB
testcase_13 AC 8 ms
5,376 KB
testcase_14 AC 8 ms
5,376 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 #

#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 = 0;
	int cnter = 0;
	failed:;
	for (int i = 0;i < 500000;++i) {
		n = n - (calc_f(n) / calc_fd(n));
	}
	//nは解の一つ
	if ((long long)n == 0) {
		if(cnter % 2 == 0){
			n = -10000000*(cnter+1);
		}else n = 10000000 * (cnter+1);
		cnter = 1;
		goto failed;
	}
	vector<long long> ans;
	ans.push_back((long long)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((long long)(topper));
	topper = -1 * w - sqrt(w*w - 4 * q*h);
	topper /= 2 * q;
	ans.push_back((long long)(topper));
	sort(ans.begin(), ans.end());
	cout << ans[0] << " " << ans[1] << " " << ans[2] << endl;
	return 0;
}
0