結果

問題 No.208 王将
ユーザー kuuso1
提出日時 2015-05-15 23:11:34
言語 C#(csc)
(csc 3.9.0)
結果
AC  
実行時間 31 ms / 1,000 ms
コード長 1,418 bytes
コンパイル時間 4,774 ms
コンパイル使用メモリ 113,528 KB
実行使用メモリ 27,660 KB
最終ジャッジ日時 2024-10-09 16:21:38
合計ジャッジ時間 2,828 ms
ジャッジサーバーID
(参考情報)
judge4 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 23
権限があれば一括ダウンロードができます
コンパイルメッセージ
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;

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

class Sol{
	public void Solve(){
		
		if(!(A[0]==A[1]||A[0]==-A[1])){
			Console.WriteLine(A.Select(x=>Math.Abs(x)).Max());
			return;
		}
		if(!(B[0]==B[1]||B[0]==-B[1])){
			Console.WriteLine(A.Select(x=>Math.Abs(x)).Max());
			return;
		}
		
		if(A[0]*B[0]<0){
			Console.WriteLine(A.Select(x=>Math.Abs(x)).Max());
			return;
		}
		
		if(A[0]+A[1]!=B[0]+B[1]&&A[0]-A[1]!=B[0]-B[1]){
			Console.WriteLine(A.Select(x=>Math.Abs(x)).Max());
			return;
		}
		
		if(Math.Abs(A[0])>Math.Abs(B[0])){
			Console.WriteLine(Math.Abs(A[0])+1);
			return;
		}
		Console.WriteLine(A.Select(x=>Math.Abs(x)).Max());
		
		
		
	}
	long[] A,B;
	public Sol(){
		A=rla();B=rla();
	}




	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(){return Console.ReadLine().Split(' ');}
	static int[] ria(){return Array.ConvertAll(Console.ReadLine().Split(' '),e=>int.Parse(e));}
	static long[] rla(){return Array.ConvertAll(Console.ReadLine().Split(' '),e=>long.Parse(e));}
	static double[] rda(){return Array.ConvertAll(Console.ReadLine().Split(' '),e=>double.Parse(e));}
}
0