PHƯỚC HƯNG OJ · THỬ THÁCH THUẬT TOÁN
#FW0000021. Số cặp ngôi nhà theo khoảng cách I (Count the Number of Houses at a Certain Distance I)
HỌC THEO LỘ TRÌNH
1 lộ trìnhBài tập thuộc lộ trình
Mục lục đề ⌄
Đang đọc
Số cặp ngôi nhà theo khoảng cách I (Count the Number of Houses at a Certain Distance I)
Count the Number of Houses at a Certain Distance I
Source: LeetCode
Version: Phuoc Hung OJ Extended
Problem Statement
Houses through form a path with unit two-way roads; an extra two-way road connects and . For every distance , count ordered pairs with at shortest distance exactly .
Input
Three integers .
Output
Print counts for distances through , separated by spaces.
Subtasks
- Subtask 1 (40 points): ; ; .
- Subtask 2 (60 points): ; .
Examples
Input
3 1 3
Output
6 0 0
Explanation
The extra road turns the three-house path into a triangle. All six ordered distinct pairs are at distance .