Submit | All submissions | Best solutions | Back to list |
CWAY - Counting paths in a complete graph |
English | Vietnamese |
A complete graph of N verticles is a graph in which there is an edge between every pair of nodes.
Your task is to count the number of paths between any pair of nodes in the graph. Note that a path cannot visit a vertex more than once.
Input
A single integer N that is the number of verticles in the graph (2 ≤ N ≤ 1000).
Output
A single integer that is the number of paths between any two nodes in the graph.
Example
Input 4 Output 5 Description For example, there are 5 paths between 1 and 2: 1-2 1-3-2 1-3-4-2 1-4-2 1-4-3-2
Added by: | Lê Đôn Khuê |
Date: | 2008-06-28 |
Time limit: | 1s |
Source limit: | 50000B |
Memory limit: | 1536MB |
Cluster: | Cube (Intel G860) |
Languages: | All except: ERL JS-RHINO NODEJS PERL6 SCM qobi VB.NET |
Resource: | VNOI Marathon '08 - Round 3/DivB Problem Setter: Lê Đôn Khuê |
hide comments
2012-08-08 13:24:30 Albert
Not more than 10000 |
|
2010-07-23 22:02:42 cegprakash
i understood the problem but confusing how to think of an algorithm for this can anyone help?? Last edit: 2010-07-23 22:12:40 |
|
2010-07-12 15:11:10 Anoop Narang
i submitted solution .... My result is 0 , but it got accepted . What does it means?? |
|
2009-06-26 08:13:21 Dunno
Hey How many digits when n equal to 1000 HELP ???? |