結果

問題 No.105 arcの六角ボルト
ユーザー リチウムリチウム
提出日時 2014-12-17 01:00:02
言語 Java21
(openjdk 21)
結果
AC  
実行時間 1,637 ms / 5,000 ms
コード長 925 bytes
コンパイル時間 3,303 ms
コンパイル使用メモリ 74,612 KB
実行使用メモリ 77,760 KB
最終ジャッジ日時 2023-09-02 16:00:17
合計ジャッジ時間 7,366 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1,637 ms
77,760 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;
import java.lang.Math.*;
public class ppp {
		
  public static void main(String[] args) {
	  Scanner sc=new Scanner(System.in);
	  double eps=10E-12;
	  int t=sc.nextInt();
	  double ansh[]=new double[t];
	  for(int p=0;p<t;p++){
		  boolean ok=false;
	     for(int i=0;i<6;i++){
		  double x=sc.nextDouble();
		  double y=sc.nextDouble();
		  if(ok)continue;
		  double min=0;
		  double max=50*Math.PI/180;
		  double ans=0;
		  for(int j=0;j<100;j++){
			  double mid=(min+max)/2;
			  double nx=1*Math.cos(mid)-0*Math.sin(mid);
			  double ny=1*Math.sin(mid)+0*Math.cos(mid);
			  if(nx-eps<=x && nx+eps>=x && ny-eps<=y && ny+eps>=y){
				  ans=mid;
				  ansh[p]=ans*180/Math.PI;
				  ok=true;
				  break;
			  }
			  if(nx-eps>x || ny+eps<y)min=mid;
			  else max=mid;
		  }
	  }
	  
	  }
	  for(int i=0;i<t;i++){
		  System.out.println(ansh[i]);
	  }
	 
  }}
0