結果

問題 No.105 arcの六角ボルト
ユーザー hotpepsihotpepsi
提出日時 2014-12-18 00:36:31
言語 C++11
(gcc 11.4.0)
結果
CE  
(最新)
AC  
(最初)
実行時間 -
コード長 855 bytes
コンパイル時間 401 ms
コンパイル使用メモリ 56,728 KB
最終ジャッジ日時 2023-09-02 18:41:15
合計ジャッジ時間 885 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)
コンパイルエラー時のメッセージ・ソースコードは、提出者また管理者しか表示できないようにしております。(リジャッジ後のコンパイルエラーは公開されます)
ただし、clay言語の場合は開発者のデバッグのため、公開されます。

コンパイルメッセージ
main.cpp: In function ‘int main(int, char**)’:
main.cpp:14:18: error: ‘atan2’ was not declared in this scope
  double a[6] = { atan2(0,1), atan2(sqrt(3)*0.5,0.5), atan2(sqrt(3)*0.5,-0.5),
                  ^~~~~
main.cpp:14:36: error: ‘sqrt’ was not declared in this scope
  double a[6] = { atan2(0,1), atan2(sqrt(3)*0.5,0.5), atan2(sqrt(3)*0.5,-0.5),
                                    ^~~~
main.cpp:14:36: note: suggested alternative: ‘qsort’
  double a[6] = { atan2(0,1), atan2(sqrt(3)*0.5,0.5), atan2(sqrt(3)*0.5,-0.5),
                                    ^~~~
                                    qsort
main.cpp:15:50: error: ‘M_PI’ was not declared in this scope
    atan2(0, -1), atan2(-sqrt(3)*0.5, -0.5) + 2 * M_PI, atan2(-sqrt(3)*0.5, 0.5) + 2 * M_PI };
                                                  ^~~~

ソースコード

diff #

#include <iostream>
#include <algorithm>
#include <sstream>
#include <vector>

using namespace std;

int main(int argc, char *argv[])
{
	cout.precision(16);
	string s;
	getline(cin, s);
	int N = atoi(s.c_str());
	double a[6] = { atan2(0,1), atan2(sqrt(3)*0.5,0.5), atan2(sqrt(3)*0.5,-0.5),
			atan2(0, -1), atan2(-sqrt(3)*0.5, -0.5) + 2 * M_PI, atan2(-sqrt(3)*0.5, 0.5) + 2 * M_PI };
	for (int t = 0; t < N; ++t) {
		getline(cin, s);
		double rad[6];
		for (int i = 0; i < 6; ++i) {
			double x, y;
			getline(cin, s);
			stringstream ss(s);
			ss >> x >> y;
			rad[i] = atan2(y,x);
			if (rad[i] < 0) {
				rad[i] += 2 * M_PI;
			}
		}
		sort(rad, rad + 6);
		double d = rad[0] / (2 * M_PI) * 360;
		if (d >= (60 - 1.0e-8)) {
			d -= 60;
		}
		if (d <= 1.0e-8) {
			d = 0;
		}
		cout << d << endl;
	}
	return 0;
}
0