Nộp bài | Các bài nộp | Làm tốt nhất | Về danh sách bài |
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
Được gửi lên bởi: | Lê Đôn Khuê |
Ngày: | 2008-06-28 |
Thời gian chạy: | 1s |
Giới hạn mã nguồn: | 50000B |
Memory limit: | 1536MB |
Cluster: | Cube (Intel G860) |
Ngôn ngữ cho phép: | ADA95 ASM32 BASH BF C CSHARP CPP C99 CLPS LISP sbcl LISP clisp D FORTRAN HASK ICON ICK JAVA LUA NEM NICE OCAML PAS-GPC PAS-FPC PERL PHP PIKE PRLG-swi PYTHON RUBY SCM guile SCM qobi ST TEXT WHITESPACE |
Nguồn bài: | VNOI Marathon '08 - Round 3/DivB Problem Setter: Lê Đôn Khuê |