Description 有N个未知数x[1..n]和N个等式组成的同余方程组: x[i]=k[i]*x[p[i]]+b[i] mod 10007 其中,k[i],b[i],x[i]∈[0,10007)∩Z 你要应付Q个事务,每个是两种情况之一: 一.询问当前x[a]的解 A a 无解输出-1 x[a]有多解输出-2 否则输出x[a] 二.修改一个等式 C a k[a] p[a] b[a] Input N 下面N行,每行三个整数k[i] p[i] b[i] Q 下面Q行,每行一个事务,格式见题目描…
http://poj.org/problem? id=1741 Description Give a tree with n vertices,each edge has a length(positive integer less than 1001). Define dist(u,v)=The min distance between node u and v. Give an integer k,for every pair (u,v) of vertices is called va…