結果

問題 No.550 夏休みの思い出(1)
ユーザー kuuso1kuuso1
提出日時 2017-08-04 00:41:38
言語 C#(csc)
(csc 3.9.0)
結果
WA  
実行時間 -
コード長 2,205 bytes
コンパイル時間 1,008 ms
コンパイル使用メモリ 109,824 KB
実行使用メモリ 20,736 KB
最終ジャッジ日時 2024-04-20 01:48:18
合計ジャッジ時間 4,431 ms
ジャッジサーバーID
(参考情報)
judge2 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 WA -
testcase_02 WA -
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 AC 30 ms
20,352 KB
testcase_21 WA -
testcase_22 WA -
testcase_23 AC 30 ms
20,352 KB
testcase_24 WA -
testcase_25 WA -
testcase_26 WA -
testcase_27 WA -
testcase_28 WA -
testcase_29 WA -
testcase_30 WA -
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 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 AC 30 ms
20,224 KB
testcase_50 AC 28 ms
20,224 KB
testcase_51 AC 28 ms
20,224 KB
testcase_52 WA -
testcase_53 WA -
testcase_54 WA -
testcase_55 WA -
testcase_56 WA -
testcase_57 WA -
権限があれば一括ダウンロードができます
コンパイルメッセージ
Microsoft (R) Visual C# Compiler version 3.9.0-6.21124.20 (db94f4cc)
Copyright (C) Microsoft Corporation. All rights reserved.

ソースコード

diff #

using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Text;

class TEST{
	static void Main(){
		Sol mySol =new Sol();
		mySol.Solve();
	}
}

class Sol{
	public void Solve(){
		
		Func<double,double,double,List<double>> solve2 = (a, b, c) =>{
			var ret = new List<double>(){
				(-b - Math.Sqrt(b * b - 4 * a * c)) / (2 * a),
				(-b + Math.Sqrt(b * b - 4 * a * c)) / (2 * a),
			};
			ret.Sort();
			return ret;
		};
		
		Func<double, double> f = x => x*x*x + (double) A * x * x + (double) B * x + (double) C;
		Func<double, double> nf = x => -f(x);
		Func<long, long> fl = x => x*x*x +  A * x * x + B * x + C;
		
		var ps = solve2(3, 2*(double)A, (double) B);
		Func<Func<double,double>,double,double,double> bins = (g, l, r) =>{
			double Eps = 1e-9;
			for(int t=0;t<100;t++){
				double c = (l + r) / 2.0;
				if(g(c) < -Eps){
					l = c;
				} else {
					r = c;
				}
			}
			return (l + r) / 2.0;
		};
		
		Func<double,List<long>> lins = t =>{
			var ret = new List<long>();
			for(long x = (long) t - 200; x < (long) t + 200;x++){
				if(f(x) == 0) ret.Add(x);
			}
			return ret;
		};
		
		List<double> candi = new List<double>(){
			bins(f, -1.1e9, ps[0]),
			bins(nf, ps[0], ps[1]),
			bins(f, ps[1], 1.1e9),
		};
		
		HashSet<long> H = new HashSet<long>();
		foreach(var xx in candi){
			var xls = lins(xx);
			foreach(var xl in xls) H.Add(xl);
		}
		
		var ans = H.ToList();
		ans.Sort();
		Console.WriteLine(String.Join(" ",ans));
	}
	long A,B,C;
	public Sol(){
		var d = rla();
		A = d[0]; B = d[1]; C = d[2];
	}

	static String rs(){return Console.ReadLine();}
	static int ri(){return int.Parse(Console.ReadLine());}
	static long rl(){return long.Parse(Console.ReadLine());}
	static double rd(){return double.Parse(Console.ReadLine());}
	static String[] rsa(char sep=' '){return Console.ReadLine().Split(sep);}
	static int[] ria(char sep=' '){return Array.ConvertAll(Console.ReadLine().Split(sep),e=>int.Parse(e));}
	static long[] rla(char sep=' '){return Array.ConvertAll(Console.ReadLine().Split(sep),e=>long.Parse(e));}
	static double[] rda(char sep=' '){return Array.ConvertAll(Console.ReadLine().Split(sep),e=>double.Parse(e));}
}
0