「DTOI-2」星之影

Luogu
IDLGP8574
Time2000ms
Memory128MB
DifficultyP4
Special JudgeO2优化
白极影化为立竿之人莅临人间,带来了星之函数 $f(x)$,它的值为最接近于 $\sqrt[4]x$ 的整数$\\$(即 $f(x)=\left\lfloor\sqrt[4]x+\dfrac12\right\rfloor$;$\lfloor u\rfloor$ 为对 $u$ 向下取整后的值)。 现有 $t$ 个数字 $n$,对于每个 $n$,立竿人想知道 $\sum\limits_{i=1}^n\dfrac1{f(i)}$ 的值是多少,请你告诉它吧。 --- ~~因为立竿人很急,所以~~本题的 $t$ 组询问强制在线,后一个询问需通过前一个询问的答案生成。 可用以下 `C++` 代码生成(其他语言同理;需包含 `<stdio.h>`): ```cpp typedef long long ll; char buf_ans[114]; ll next_n(double last_ans=0,ll get_n=0){ //last_ans<n<=1e18 sprintf(buf_ans,"%.6f",last_ans); for(ll i=0,x=0;;i++){ if(buf_ans[i]=='.')return get_n^x; if(i&1)x*=10; else x=x*10+(buf_ans[i]^48); } } ``` 该函数第一个参数为上一次询问的答案(第一次询问时该值为 $0$,也就是说第一个数未经加密),第二个参数为这一次读入的被加密的数,函数返回解密后的 $n$。 ## Input 第一行一个整数 $t$,表示数据组数(询问次数)。 对于每组数据,仅一行一个整数表示加密后的 $n$(第一个 $n$ 未被加密)。 ## Output 每行输出一个六位小数,表示答案。 [samples] ## Background >闻是白极影,见时方立竿。 ## Note ### 样例解释 样例#1 解密后各组询问分别是: $$ \def\r{\cr\hline} \def\arraystretch{1.5}\begin{array}{|c|c|c|c|c|c|c|c|}\hline \textbf{t}&1&2&3&4&5&6&7\r \textbf{n}&1&4&8&89&2022&1145141919810&1\r \end{array} $$ ### 数据范围 **本题采用捆绑测试。** $$ \def\arraystretch{1.5}\begin{array}{|c|c|c|c|}\hline \textbf{Subtask} & t= & n\le&\bm{\textbf{Score}} \cr\hline 1 & 10&10^6 & 2 \cr\hline 2&1000&10^6&13\cr\hline 3&100&10^9&15\cr\hline 4 &1000&10^{18}&40\cr\hline 5 &%\text{No Special Constraints} 5\times10^5&10^{18}& 30 \cr\hline \end{array} $$ 对于 $100\%$ 的数据,$10 \le t \le 5\times10^5$,$1 \le n \le 10^{18}$。 ### 计分规则 本题采用 $\textbf{Special Judge}$,令你输出的答案为 $\text{pans}$,标答答案为 $\text{jans}$,如果 $\vert \text{pans}-\text{jans}\vert<\text{jans}\times10^{-5}$ 那么该组数据通过,在一个测试点内只有所有 $t$ 组数据通过该测试点才算通过。 注意后一个 $\text{Subtask}$ 对前一个 $\text{Subtask}$ 有依赖关系,即如果你没有在前一个 $\text{Subtask}$ 拿到分,那么你即使通过后一个 $\text{Subtask}$ 的所有测试点,你也无法拿到后面的分数。
Samples
Input #1
7
1
5
12
95
2040
1145141920209
1070909051
Output #1
1.000000
4.000000
6.500000
38.666667
403.857143
1475989956.412959
1.000000
API Response (JSON)
{
  "problem": {
    "name": "「DTOI-2」星之影",
    "description": {
      "content": "白极影化为立竿之人莅临人间,带来了星之函数 $f(x)$,它的值为最接近于 $\\sqrt[4]x$ 的整数$\\\\$(即 $f(x)=\\left\\lfloor\\sqrt[4]x+\\dfrac12\\right\\rfloor$;$\\lfloor u\\rfloor$ 为对 $u$ 向下取整后的值)。 现有 $t$ 个数字 $n$,对于每个 $n$,立竿人想知道 $\\sum\\limits_{i=1}^n\\",
      "description_type": "Markdown"
    },
    "platform": "Luogu",
    "limit": {
      "time_limit": 2000,
      "memory_limit": 131072
    },
    "difficulty": {
      "LuoguStyle": "P4"
    },
    "is_remote": true,
    "is_sync": true,
    "sync_url": null,
    "sign": "LGP8574"
  },
  "statements": [
    {
      "statement_type": "Markdown",
      "content": "白极影化为立竿之人莅临人间,带来了星之函数 $f(x)$,它的值为最接近于 $\\sqrt[4]x$ 的整数$\\\\$(即 $f(x)=\\left\\lfloor\\sqrt[4]x+\\dfrac12\\right\\rfloor$;$\\lfloor u\\rfloor$ 为对 $u$ 向下取整后的值)。\n\n现有 $t$ 个数字 $n$,对于每个 $n$,立竿人想知道 $\\sum\\limits_{i=1}^n\\...",
      "is_translate": false,
      "language": "English"
    }
  ]
}
Full JSON Raw Segments