N Div Tree
Practice
3.7 (3 votes)
Algorithms
Graphs
Hard
Problem
44% Success 419 Attempts 50 Points 2s Time Limit 256MB Memory 1024 KB Max Code
Given a tree having N nodes numbered from 1 to N, You have to find the number of paths \((u,\;v)\) such that on path from u to v there should not exist any pair of nodes \((a,\;b)\) such that a divides b.
Input Format:
First line consists of a single integer denoting N.
Following \(N-1\) lines consists of two space separated integers \(u, v\) denoting there is an edge between node numbered u and node numbered v.
Output Format:
Print the required answer.
Constraints:
\(1 \le N \le 10^5\)
\(1 \le u, v \le N\)
Please login to use the editor
You need to be logged in to access the code editor
Loading...
Please wait while we load the editor
Results
Custom Input
Run your code to see the output
Submissions
Please login to view your submissions
Similar Problems
Points:50
2 votes
Tags:
GraphsAlgorithmsGraph Representation
Points:30
26 votes
Tags:
Ad-hocAlgorithmsBasic ProgrammingMediumOpenRoot
Points:50
5 votes
Tags:
AlgorithmsApprovedGraphsHardOpen
Editorial
No editorial available for this problem.