跳到正文

题解

题解:P10314 [SHUPC 2024] 函数

lkrqwq约 1 分钟
原文
文章信息与版本

文章信息

发布
2024年4月5日
收录
2025年12月12日
更新
2026年11月6日
篇幅
约 1 分钟
题目
P10314

版本

  1. v1当前

这道题很简单,模拟就行了。

要注意: cot⁡x=1tan⁡x\cot x=\frac{1}{\tan x}。

C++
#include <bits/stdc++.h>
#define pi acos(-1)
using namespace std;
int main() {
	int t;
	cin >> t;
	while (t--) {
		double x;
		cin >> x;
		printf("%.6lf\n", x - 0.5 + 1.0 * atan(1.0 / tan(pi * x)) / pi);
	}
}
原文