提出 #44348463


ソースコード 拡げる

Copy
Copy
  1. #include <stdio.h>
  2.  
  3. void x87_sincos(double* sin_res, double* cos_res, double angle) {
  4. __asm__ __volatile__(
  5. "fldl %2\n\t"
  6. "fsincos\n\t"
  7. "fstpl %1\n\t"
  8. "fstpl %0\n\t"
  9. : "=m"(*sin_res), "=m"(*cos_res) : "m"(angle));
  10. }
  11.  
  12. double x87_sqrt(double value) {
  13. double res;
  14. __asm__ __volatile__(
  15. "fldl %1\n\t"
  16. "fsqrt\n\t"
  17. "fstpl %0\n\t"
  18. : "=m"(res) : "m"(value));
  19. return res;
  20. }
  21.  
  22. double x87_atan2(double y, double x) {
  23. double res;
  24. __asm__ __volatile__(
  25. "fldl %1\n\t"
  26. "fldl %2\n\t"
  27. "fpatan\n\t"
  28. "fstpl %0\n\t"
  29. : "=m"(res) : "m"(y), "m"(x));
  30. return res;
  31. }
  32.  
  33. int main(void) {
  34. double PI = x87_atan2(1, 1) * 4;
  35. double T;
  36. double L, X, Y;
  37. int Q;
  38. int i;
  39. if (scanf("%lf", &T) != 1) return 1;
  40. if (scanf("%lf%lf%lf", &L, &X, &Y) != 3) return 1;
  41. if (scanf("%d", &Q) != 1) return 1;
  42. for (i = 0; i < Q; i++) {
  43. double E;
  44. double s, c;
  45. double y, z;
  46. double teihen, takasa;
  47. if(scanf("%lf", &E) != 1) return 1;
  48. x87_sincos(&s, &c, 2.0 * PI * E / T);
  49. y = -(L / 2) * s;
  50. z = (L / 2) - (L / 2) * c;
  51. teihen = x87_sqrt(X * X + (Y - y) * (Y - y));
  52. takasa = z;
  53. printf("%.15f\n", x87_atan2(takasa, teihen) * 180.0 / PI);
  54. }
  55. return 0;
  56. }
#include <stdio.h>

void x87_sincos(double* sin_res, double* cos_res, double angle) {
	__asm__ __volatile__(
		"fldl %2\n\t"
		"fsincos\n\t"
		"fstpl %1\n\t"
		"fstpl %0\n\t"
	: "=m"(*sin_res), "=m"(*cos_res) : "m"(angle));
}

double x87_sqrt(double value) {
	double res;
	__asm__ __volatile__(
		"fldl %1\n\t"
		"fsqrt\n\t"
		"fstpl %0\n\t"
	: "=m"(res) : "m"(value));
	return res;
}

double x87_atan2(double y, double x) {
	double res;
	__asm__ __volatile__(
		"fldl %1\n\t"
		"fldl %2\n\t"
		"fpatan\n\t"
		"fstpl %0\n\t"
	: "=m"(res) : "m"(y), "m"(x));
	return res;
}

int main(void) {
	double PI = x87_atan2(1, 1) * 4;
	double T;
	double L, X, Y;
	int Q;
	int i;
	if (scanf("%lf", &T) != 1) return 1;
	if (scanf("%lf%lf%lf", &L, &X, &Y) != 3) return 1;
	if (scanf("%d", &Q) != 1) return 1;
	for (i = 0; i < Q; i++) {
		double E;
		double s, c;
		double y, z;
		double teihen, takasa;
		if(scanf("%lf", &E) != 1) return 1;
		x87_sincos(&s, &c, 2.0 * PI * E / T);
		y = -(L / 2) * s;
		z = (L / 2) - (L / 2) * c;
		teihen = x87_sqrt(X * X + (Y - y) * (Y - y));
		takasa = z;
		printf("%.15f\n", x87_atan2(takasa, teihen) * 180.0 / PI);
	}
	return 0;
}

提出情報

提出日時
問題 018 - Statue of Chokudai(★3)
ユーザ mikecat
言語 C (GCC 9.2.1)
得点 3
コード長 1211 Byte
結果 AC
実行時間 5 ms
メモリ 1748 KB

ジャッジ結果

セット名 Sample All
得点 / 配点 0 / 0 3 / 3
結果
AC × 2
AC × 27
セット名 テストケース
Sample 00_sample_00.txt, 00_sample_01.txt
All 00_sample_00.txt, 00_sample_01.txt, 10_random_small_00.txt, 10_random_small_01.txt, 10_random_small_02.txt, 10_random_small_03.txt, 10_random_small_04.txt, 10_random_small_05.txt, 10_random_small_06.txt, 10_random_small_07.txt, 10_random_small_08.txt, 10_random_small_09.txt, 11_random_large_00.txt, 11_random_large_01.txt, 11_random_large_02.txt, 11_random_large_03.txt, 11_random_large_04.txt, 11_random_large_05.txt, 11_random_large_06.txt, 11_random_large_07.txt, 11_random_large_08.txt, 11_random_large_09.txt, 20_random_max_00.txt, 20_random_max_01.txt, 20_random_max_02.txt, 20_random_max_03.txt, 20_random_max_04.txt
ケース名 結果 実行時間 メモリ
00_sample_00.txt AC 4 ms 1692 KB
00_sample_01.txt AC 3 ms 1648 KB
10_random_small_00.txt AC 1 ms 1656 KB
10_random_small_01.txt AC 1 ms 1668 KB
10_random_small_02.txt AC 1 ms 1708 KB
10_random_small_03.txt AC 1 ms 1672 KB
10_random_small_04.txt AC 1 ms 1652 KB
10_random_small_05.txt AC 2 ms 1728 KB
10_random_small_06.txt AC 1 ms 1684 KB
10_random_small_07.txt AC 1 ms 1652 KB
10_random_small_08.txt AC 1 ms 1696 KB
10_random_small_09.txt AC 2 ms 1724 KB
11_random_large_00.txt AC 1 ms 1672 KB
11_random_large_01.txt AC 2 ms 1740 KB
11_random_large_02.txt AC 3 ms 1672 KB
11_random_large_03.txt AC 2 ms 1748 KB
11_random_large_04.txt AC 2 ms 1644 KB
11_random_large_05.txt AC 2 ms 1632 KB
11_random_large_06.txt AC 2 ms 1748 KB
11_random_large_07.txt AC 2 ms 1732 KB
11_random_large_08.txt AC 2 ms 1672 KB
11_random_large_09.txt AC 2 ms 1680 KB
20_random_max_00.txt AC 2 ms 1636 KB
20_random_max_01.txt AC 5 ms 1728 KB
20_random_max_02.txt AC 2 ms 1636 KB
20_random_max_03.txt AC 2 ms 1736 KB
20_random_max_04.txt AC 2 ms 1648 KB


2023-08-06 (日)
22:43:53 +00:00