BZOJ3518 点组计数

Luogu
IDLGP10636
Time1000ms
Memory512MB
DifficultyP6
数论O2优化莫比乌斯反演
平面上摆放着一个 $n\times m$ 的点阵,如下图是一个 $3\times 4$ 的点阵图: ![](https://cdn.luogu.com.cn/upload/image_hosting/6tq3jene.png) 现问,有多少个三元点对组 $(a,b,c)$ 满足 $a,b,c$ 三点共线,顺序无关紧要,例如 $(a,b,c)$ 与 $(b,c,a)$ 算一组。答案对 $10^9+7$ 取模。 ## Input 一行,两个正整数 $n,m$。 ## Output 一行一个整数,表示答案对 $10^9+7$ 取模后的结果。 [samples] ## Note 数据保证,$1\leq n,m\leq 5\times 10^4$。
Samples
Input #1
3 4
Output #1
20
API Response (JSON)
{
  "problem": {
    "name": "BZOJ3518 点组计数",
    "description": {
      "content": "平面上摆放着一个 $n\\times m$ 的点阵,如下图是一个 $3\\times 4$ 的点阵图: ![](https://cdn.luogu.com.cn/upload/image_hosting/6tq3jene.png) 现问,有多少个三元点对组 $(a,b,c)$ 满足 $a,b,c$ 三点共线,顺序无关紧要,例如 $(a,b,c)$ 与 $(b,c,a)$ 算一组。答案对 $10^9",
      "description_type": "Markdown"
    },
    "platform": "Luogu",
    "limit": {
      "time_limit": 1000,
      "memory_limit": 524288
    },
    "difficulty": {
      "LuoguStyle": "P6"
    },
    "is_remote": true,
    "is_sync": true,
    "sync_url": null,
    "sign": "LGP10636"
  },
  "statements": [
    {
      "statement_type": "Markdown",
      "content": "平面上摆放着一个 $n\\times m$ 的点阵,如下图是一个 $3\\times 4$ 的点阵图:\n\n![](https://cdn.luogu.com.cn/upload/image_hosting/6tq3jene.png)\n\n现问,有多少个三元点对组 $(a,b,c)$ 满足 $a,b,c$ 三点共线,顺序无关紧要,例如 $(a,b,c)$ 与 $(b,c,a)$ 算一组。答案对 $10^9...",
      "is_translate": false,
      "language": "English"
    }
  ]
}
Full JSON Raw Segments