結果

問題 No.105 arcの六角ボルト
ユーザー CleyLCleyL
提出日時 2024-02-17 20:40:45
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 67 ms / 5,000 ms
コード長 2,511 bytes
コンパイル時間 1,471 ms
コンパイル使用メモリ 128,520 KB
実行使用メモリ 6,548 KB
最終ジャッジ日時 2024-02-17 20:40:48
合計ジャッジ時間 2,316 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #


//yukicoder@cpp17

#include <iostream>
#include <iomanip>

#include <algorithm>

#include <cmath>
#include <cctype>
#include <climits>
#include <cassert>

#include <string>
#include <vector>
#include <set>
#include <stack>
#include <queue>
#include <map>

#include <random>

#include <bitset>

#include <complex>

#include <utility>

#include <numeric>

#include <functional>


using namespace std;
using ll = long long;
using P = pair<ll,ll>;


const ll MOD = 998244353;
const ll MODx = 1000000007;
const int INF = (1<<30)-1;
const ll LINF = (1LL<<62LL)-1;
const double EPS = (1e-10);


P ar4[4] = {{0,1},{0,-1},{1,0},{-1,0}};
P ar8[8] = {{-1,-1},{-1,0},{-1,1},{0,-1},{0,1},{1,-1},{1,0},{1,1}};


template <typename T> vector<T> make_vector(size_t a, T b) { return vector<T>(a, b); }
template <typename... Ts> auto make_vector(size_t a, Ts... ts) { return vector<decltype(make_vector(ts...))>(a, make_vector(ts...)); }
 
/*
確認ポイント
cout << fixed << setprecision(n) << 小数計算//n桁の小数表記になる

計算量は変わらないが楽できるシリーズ
min(max)_element(iter,iter)で一番小さい(大きい)値のポインタが帰ってくる
count(iter,iter,int)でintがiterからiterの間にいくつあったかを取得できる
*/

/* comment outed because can cause bugs
__attribute__((constructor))
void initial() {
  cin.tie(0);
  ios::sync_with_stdio(false);
}
*/

void solve(){
  vector<pair<long double, long double>> A(6);
  long double mn = 2;
  int mni = -1;
  for(int i = 0; 6 > i; i++){
    cin>>A[i].first>>A[i].second;
    if(mn > A[i].first){
      mn = A[i].first;
      mni = i;
    }
  }
  if(A[mni].second > 0){
    long double dist1 = (((A[mni].first)*(A[mni].first))+(A[mni].second*A[mni].second));
    long double dist2 = (((A[mni].first-1)*(A[mni].first-1))+(A[mni].second*A[mni].second));
    long double ans = (acos((dist1+dist1-dist2)/(2))*180/acos((long double)-1) - 120);
    if(ans + EPS > 50)ans = 0;
    cout << fixed << setprecision(10) << (isnanl(ans) ? 0 : ans) << endl;
  }else{
    long double dist1 = (((A[mni].first)*(A[mni].first))+(A[mni].second*A[mni].second));
    long double dist2 = (((A[mni].first-1)*(A[mni].first-1))+(A[mni].second*A[mni].second));
    long double ans = (180.0 - acos((dist1+dist1-dist2)/(2))*180/acos((long double)-1));
    if(ans + EPS > 50)ans = 0;
    cout << fixed << setprecision(10) << (isnanl(ans) ? 0 : ans) << endl;
  }
  return;

}

int main(){
  int t;cin>>t;
  for(int i= 0; t > i; i++)solve();
}
0