[GESP202406 七级] 区间乘积

Luogu
IDLGP10724
Time1000ms
Memory500MB
DifficultyP4
2024数论前缀和位运算GESP
小杨有一个包含 $n$ 个正整数的序列 $A=[a_1,a_2,\ldots,a_n]$。 小杨想知道有多少对 $\langle l,r\rangle(1\leq l\leq r\leq n)$ 满足 $a_l\times a_{l+1}\times\ldots\times a_r$ 为完全平方数。 一个正整数 $x$ 为完全平方数当且仅当存在一个正整数 $y$ 使得 $x=y\times y$。 ## Input 第一行包含一个正整数 $n$,代表正整数个数。 第二行包含 $n$ 个正整数 $a_i$,代表序列 $A$。 ## Output 输出一个整数,代表满足要求的 $\langle l,r\rangle$ 数量。 [samples] ## Background 对应的选择、判断题:<https://ti.luogu.com.cn/problemset/1155> ## Note ### 样例解释 满足条件的 $\langle l,r\rangle$ 有 $\langle 1,5\rangle$ 和 $\langle 3,3\rangle$。 ### 数据范围 子任务编号|数据点占比|$n$|$a_i$ :-:|:-:|:-:|:-: $1$|$20\%$|$\leq 10^5$|$1\leq a_i\leq 2$ $2$|$40\%$|$\leq 100$|$1\leq a_i\leq 30$ $3$|$40\%$|$\leq 10^5$|$1\leq a_i\leq 30$
Samples
Input #1
5
3 2 4 3 2
Output #1
2
API Response (JSON)
{
  "problem": {
    "name": "[GESP202406 七级] 区间乘积",
    "description": {
      "content": "小杨有一个包含 $n$ 个正整数的序列 $A=[a_1,a_2,\\ldots,a_n]$。 小杨想知道有多少对 $\\langle l,r\\rangle(1\\leq l\\leq r\\leq n)$ 满足 $a_l\\times a_{l+1}\\times\\ldots\\times a_r$ 为完全平方数。 一个正整数 $x$ 为完全平方数当且仅当存在一个正整数 $y$ 使得 $x=y\\times y",
      "description_type": "Markdown"
    },
    "platform": "Luogu",
    "limit": {
      "time_limit": 1000,
      "memory_limit": 512000
    },
    "difficulty": {
      "LuoguStyle": "P4"
    },
    "is_remote": true,
    "is_sync": true,
    "sync_url": null,
    "sign": "LGP10724"
  },
  "statements": [
    {
      "statement_type": "Markdown",
      "content": "小杨有一个包含 $n$ 个正整数的序列 $A=[a_1,a_2,\\ldots,a_n]$。\n\n小杨想知道有多少对 $\\langle l,r\\rangle(1\\leq l\\leq r\\leq n)$ 满足 $a_l\\times a_{l+1}\\times\\ldots\\times a_r$ 为完全平方数。\n\n一个正整数 $x$ 为完全平方数当且仅当存在一个正整数 $y$ 使得 $x=y\\times y...",
      "is_translate": false,
      "language": "English"
    }
  ]
}
Full JSON Raw Segments