Problem 2975 --Coefficient

2975: Coefficient

"
Time Limit $14$ 秒/Second(s) Memory Limit $512$ 兆字节/Megabyte(s)
提交总数 $1$ 正确数量 $1$
裁判形式 标准裁判/Standard Judge 我的状态 尚未尝试
难度 分类标签
Given a function f(x)=bc+eax+df(x)=bc+eax+d, where a≢0(mod998244353)a≢0(mod998244353)

Denote x0x0 as the smallest real solution of the equation: ax+d=0ax+d=0, and note that the solution always exists. 

Output the coefficient of the item (x−x0)n(x−x0)n in the Taylor series of f(x)f(x) at x=x0x=x0. The answer may be very large, so you just need to output the answer modulo 998244353998244353

Note that for the given nn, your task is to answer qq queries which share the same parameter nn

Note that it is not guaranteed that the answer could be represented as rational fraction pqpqwhere gcd(p,q)=1gcd(p,q)=1, or qq has no multiplicative inverse element modulo 998244353998244353. If it can, print it as pq−1pq−1 modulo 998244353998244353 which is not negative. Otherwise just print −1−1

If you knew little about gcdgcd in mathematic, please refer tohttps://en.wikipedia.org/wiki/Greatest_common_divisor

If you knew little about Taylor_seriesTaylor_series in mathematic, please refer tohttps://en.wikipedia.org/wiki/Taylor_series
There are multiple test cases. 

Each case starts with a line containing two integers nn and qq seperated by a space. 

Next qq lines in every test case will include four integers aabbccdd per line, seperated by 33spaces. 

It is guaranteed that ∀t∈{a,b,c,d},|t|≤109∀t∈{a,b,c,d},|t|≤109 and n,q∈[0,5×104]n,q∈[0,5×104]

It is guaranteed that the sum of nn and the sum of qq in all test cases are both no larger than 3×1053×105.
For each query in each test case, output the only line containing just one integer denoting the answer if there would be, or −1−1 otherwise.
0 1
1 1 1 1
499122177

推荐代码 查看2975 所有题解 上传题解视频得图灵币

本题记录 用 户(点击查看用户) 运行号(点击购买题解) 时 间
算法最快[$4096 $ms] 刘成健 483718 2019-10-10 20:28:04
内存最少[$28180 $KB] 刘成健 483718 2019-10-10 20:28:04
第一AC 刘成健 483718 2019-10-10 20:28:04
第一挑战 刘成健 483718 2019-10-10 20:28:04

赛题来源/所属竞赛 2019 Multi-University Training Contest 2 N/A

竞赛编号 竞赛名称 竞赛时间 访问比赛