306727: CF1244A. Pens and Pencils

Memory Limit:256 MB Time Limit:1 S
Judge Style:Text Compare Creator:
Submit:0 Solved:0

Description

Pens and Pencils

题意翻译

题目简述: t组数据,每组a,b,c,d,k 一只钢笔可以写c次讲座,一只铅笔可以写d次绘画课,现在有a次讲座,b次绘画课,文具盒里面可以存k支笔,如果有解满足上完所有课程,则输出解,否则输出-1

题目描述

Tomorrow is a difficult day for Polycarp: he has to attend $ a $ lectures and $ b $ practical classes at the university! Since Polycarp is a diligent student, he is going to attend all of them. While preparing for the university, Polycarp wonders whether he can take enough writing implements to write all of the lectures and draw everything he has to during all of the practical classes. Polycarp writes lectures using a pen (he can't use a pencil to write lectures!); he can write down $ c $ lectures using one pen, and after that it runs out of ink. During practical classes Polycarp draws blueprints with a pencil (he can't use a pen to draw blueprints!); one pencil is enough to draw all blueprints during $ d $ practical classes, after which it is unusable. Polycarp's pencilcase can hold no more than $ k $ writing implements, so if Polycarp wants to take $ x $ pens and $ y $ pencils, they will fit in the pencilcase if and only if $ x + y \le k $ . Now Polycarp wants to know how many pens and pencils should he take. Help him to determine it, or tell that his pencilcase doesn't have enough room for all the implements he needs tomorrow! Note that you don't have to minimize the number of writing implements (though their total number must not exceed $ k $ ).

输入输出格式

输入格式


The first line of the input contains one integer $ t $ ( $ 1 \le t \le 100 $ ) — the number of test cases in the input. Then the test cases follow. Each test case is described by one line containing five integers $ a $ , $ b $ , $ c $ , $ d $ and $ k $ , separated by spaces ( $ 1 \le a, b, c, d, k \le 100 $ ) — the number of lectures Polycarp has to attend, the number of practical classes Polycarp has to attend, the number of lectures which can be written down using one pen, the number of practical classes for which one pencil is enough, and the number of writing implements that can fit into Polycarp's pencilcase, respectively. In hacks it is allowed to use only one test case in the input, so $ t = 1 $ should be satisfied.

输出格式


For each test case, print the answer as follows: If the pencilcase can't hold enough writing implements to use them during all lectures and practical classes, print one integer $ -1 $ . Otherwise, print two non-negative integers $ x $ and $ y $ — the number of pens and pencils Polycarp should put in his pencilcase. If there are multiple answers, print any of them. Note that you don't have to minimize the number of writing implements (though their total number must not exceed $ k $ ).

输入输出样例

输入样例 #1

3
7 5 4 5 8
7 5 4 5 2
20 53 45 26 4

输出样例 #1

7 1
-1
1 3

说明

There are many different answers for the first test case; $ x = 7 $ , $ y = 1 $ is only one of them. For example, $ x = 3 $ , $ y = 1 $ is also correct. $ x = 1 $ , $ y = 3 $ is the only correct answer for the third test case.

Input

题意翻译

题目简述: t组数据,每组a,b,c,d,k 一只钢笔可以写c次讲座,一只铅笔可以写d次绘画课,现在有a次讲座,b次绘画课,文具盒里面可以存k支笔,如果有解满足上完所有课程,则输出解,否则输出-1

加入题单

算法标签: