n Div Tree#5067

n Div Tree

2 sekonda
122,174 megabajt
E lehtë

Given a tree having nodes numbered from to , you have to find the number of paths (, ) such that on path from to there should not exist any pair of nodes (, ) such that divides .

Hyrja

The first line consists of a single integer denoting . The following n - 1 lines consist of two space separated integers , denoting there is an edge between node numbered and node numbered .

Dalja

Print the required answer.

Shembuj

Shembulli 1

Loading
Loading