# | Problem | Pass Rate (passed user / total user) |
---|---|---|
14682 | Check if line segment passes through the origin |
|
14683 | Compute number of animals in a cage |
|
14684 | Determine if line segments can form a triangle |
|
Description
Input four positive integers a,b,c,d. These represent two distinct points (a,b) and (c,d).
If the line segment connecting (a,b) and (c,d) passes through the origin (0,0), output 1
. Otherwise, output 0
.
(Hint: Recall y = ax + b)
Input
Input four integers: a,b,c,d.
Output
One integer: 1
if the line segment passes through the origin, otherwise 0
.
Ensure that the output, including formatting, exactly matches the provided samples.
Sample Input Download
Sample Output Download
Tags
Discuss
Description
There are rabbits, chickens, and crabs in a cage.
You are given:
-
the total number of animals,
-
the total number of legs, and
-
the total number of tails.
Compute the number of rabbits, chickens, and crabs.
If no valid solution exists (like 9, 48, and 20), output 0
.
For your information,
- Crab has no tail but 8 legs
- Rabbit has 1 tail and 4 legs
- Chicken has 1 tail and 2 legs
(Hint: Recall the linear equation in variables. 聯立方程式)
Input
Input three positive integers: total number of animals, total number of legs, total number of tails.
Output
-
If a solution exists, output three positive integers in order: number of rabbits, chickens, and crabs.
-
Otherwise, output a single
0
.
Ensure that the output, including formatting, exactly matches the provided samples.
Sample Input Download
Sample Output Download
Tags
Discuss
Description
Write a program to determine if three line segments can form a triangle.
You may translate the line segments, but you cannot rotate or flip them.
It is guaranteed that all line segments have different slopes, so you do not need to worry about zero-area triangles.
The input contains 12 integers. Each group of 4 integers represents the x,y coordinates of the start and end points of one line segment.
If the three line segments can form a triangle, output 1
; otherwise, output 0
.
(Hint: Recall the the vector components 向量分量)
Input
12 integers, representing the coordinates of the three line segments.
Each group of 4 integers represents the x,y coordinates of the start and end points of one line segment. i.e. (x_start y_start x_end y_end)
Output
One integer: 1
if the segments can form a triangle, otherwise 0
.
Ensure that the output, including formatting, exactly matches the provided samples.