Logo
(追記) (追記ここまで)

24807번 - Math Homework 다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
1 초 (추가 시간 없음) 1024 MB53928624451.695%

문제

Since entering 2nd grade Theta has daily math homework sheets. The problems on her worksheet usually go like this:

There is a certain number of birds, dogs, and cats on a farm. Together they have 14ドル$ legs. How many birds, dogs, and cats could there be? Write down as many answers as you can!

It is always the same problem, just written in different ways: sometimes with horses, cows, sheep, goats, chickens, beetles, or even spiders (but never with snakes or fishes!)

Can you write a program to double-check Theta's answers?

입력

Input consists of a single line with 4ドル$ integers: $b,ドル $d,ドル $c,ドル and $l,ドル with $b,ドル $d,ドル and $c$ representing the numbers of legs the first, second, and third type of animal has. You are given that 0ドル < b, c, d \le 100$ because some farm animals in these math problems may be centipedes. The total number of legs is given by $l$ (0ドル \le l \le 250$).

출력

Output all possible answers, each on a separate line, in lexicographical order so that they are sorted by the number of the first animal, ties broken by the second and third animal, respectively. Separate the number of the first, second, and third animal with spaces. If there are no possible solutions, output impossible on a single line!

제한

예제 입력 1

2 4 4 14

예제 출력 1

1 0 3
1 1 2
1 2 1
1 3 0
3 0 2
3 1 1
3 2 0
5 0 1
5 1 0
7 0 0

예제 입력 2

100 80 60 240

예제 출력 2

0 0 4
0 3 0
1 1 1

예제 입력 3

2 4 6 9

예제 출력 3

impossible

힌트

출처

School > Virginia Tech High School Programming Contest > 2018 Virginia Tech High School Programming Contest C번

  • 문제를 만든 사람: Godmar Back
(追記) (追記ここまで)

출처

대학교 대회

  • 사업자 등록 번호: 541-88-00682
  • 대표자명: 최백준
  • 주소: 서울시 서초구 서초대로74길 29 서초파라곤 412호
  • 전화번호: 02-521-0487 (이메일로 연락 주세요)
  • 이메일: contacts@startlink.io
  • 통신판매신고번호: 제 2017-서울서초-2193 호

AltStyle によって変換されたページ (->オリジナル) /