結果

問題 No.550 夏休みの思い出(1)
ユーザー kuuso1kuuso1
提出日時 2017-04-08 00:42:34
言語 C#(csc)
(csc 3.9.0)
結果
WA  
実行時間 -
コード長 2,003 bytes
コンパイル時間 2,259 ms
コンパイル使用メモリ 109,776 KB
実行使用メモリ 24,812 KB
最終ジャッジ日時 2023-09-23 03:22:21
合計ジャッジ時間 8,078 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 66 ms
22,756 KB
testcase_01 AC 67 ms
20,632 KB
testcase_02 WA -
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 AC 69 ms
20,728 KB
testcase_09 AC 66 ms
22,808 KB
testcase_10 AC 65 ms
20,728 KB
testcase_11 AC 64 ms
20,560 KB
testcase_12 AC 65 ms
20,648 KB
testcase_13 AC 66 ms
22,744 KB
testcase_14 AC 66 ms
20,724 KB
testcase_15 WA -
testcase_16 AC 65 ms
20,688 KB
testcase_17 AC 65 ms
20,848 KB
testcase_18 AC 65 ms
22,680 KB
testcase_19 AC 65 ms
20,824 KB
testcase_20 WA -
testcase_21 WA -
testcase_22 WA -
testcase_23 WA -
testcase_24 WA -
testcase_25 WA -
testcase_26 WA -
testcase_27 WA -
testcase_28 WA -
testcase_29 WA -
testcase_30 WA -
testcase_31 AC 65 ms
20,844 KB
testcase_32 AC 64 ms
20,708 KB
testcase_33 AC 65 ms
20,640 KB
testcase_34 AC 65 ms
20,756 KB
testcase_35 AC 65 ms
20,720 KB
testcase_36 AC 65 ms
20,808 KB
testcase_37 AC 65 ms
20,780 KB
testcase_38 AC 65 ms
22,616 KB
testcase_39 AC 66 ms
20,716 KB
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 AC 64 ms
22,756 KB
testcase_51 WA -
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;
using System.IO;
using System.Diagnostics;
using System.Diagnostics.Contracts;
using CT = System.Diagnostics.Contracts.Contract;
using System.Numerics;
class TEST{
	static void Main(){
		Sol mySol =new Sol();
		mySol.Solve();
	}
}

class Sol{
	public void Solve(){
		
		List<long> L = new List<long>();
		
		long alpha = 0;
		// at least 1 solution with absolute value < 1e6
		for(long j=0;j<1e6;j++){
			if(j*j*j + A*j*j + B*j + C == 0){
				alpha = j;
				L.Add(alpha);
				break;
			}
		}
		for(long j=0;j<1e6;j++){
			if(-j*j*j + A*j*j - B*j + C == 0){
				alpha = -j;
				L.Add(alpha);
				break;
			}
		}
		
		// solve 2-equation y^2 + A2*y + B2 = 0
		// A = -(alpha + beta + gamma); B = alpha*beta + beta*gamma + gamma*alpha
		// -> A2 := -(beta + gamma) = A + alpha;
		//    B2 = beta*gamma = B - alpha (beta + gamma) = B + alpha*A2;
		long A2 = 0;
		long B2 = 0;
		long D = 0;
		A2 = A + alpha;	// -(beta + gamma)
		B2 = B + alpha*A + alpha*alpha;	// beta * gamma
		D = A2*A2 - 4*B2;	// determinant
		long sqrtD = (long)Math.Sqrt((double)D);
		L.Add( (-A2 + sqrtD)/2 );
		L.Add( (-A2 - sqrtD)/2 );
		
		
		L.Sort();
		Console.WriteLine(String.Join(" ",L.ToArray()));
		
	}
	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