Problem 1445 --Equation

1445: Equation

"
Time Limit $1$ 秒/Second(s) Memory Limit $512$ 兆字节/Megabyte(s)
提交总数 $0$ 正确数量 $0$
裁判形式 标准裁判/Standard Judge 我的状态 尚未尝试
难度 分类标签
CO-CO met Prophet and invited him to join his team. But Prophet didn’t want his boss be just a sailor. So Prophet proposed a relatively popular question – “quadratic equation”. Prophet said he would stay if CO-CO can solve the problem. Fortunately CO-CO solved it quickly. But Prophet seemed very unhappy with his pride, so he added a condition:



X is the minimum non-negative integer which satisfied the above equation.
Can you help poor CO-CO to solve the problem under the new condition?
The input includes several cases. For each case, there is only one line contain A,B,C and p. (-200000000<A, B, C, p<200000000,and p is a prime)
For each case, output a single integer x. If the equation has no solution, just output -1.

1 -2 1 7
0 1 -1 13
1
1
Random Algorithm

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

本题记录 用 户(点击查看用户) 运行号(点击购买题解) 时 间
算法最快[$ $ms]
内存最少[$ $KB]
第一AC
第一挑战

赛题来源/所属竞赛 ACM/ICPC Anhui Program Contest 1st N/A

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