301071: CF203A. Two Problems

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

Description

Two Problems

题意翻译

一个男孩珐乐菈在CF注册了一个账号叫做珐乐菈,然后做了他的第一个比赛#300。他跟他的朋友阿卡狄炫耀在他的第一个比赛里他得了$x$分。但是阿卡狄并不相信他朋友的话,然后决定去查珐乐菈能不能的这样的分数。 他知道比赛编号$300$很不寻常因为这个比赛只有两道题。这次比赛进行了$t$秒,时间是从0分开始计数。第一道题最开始有$a$分,然后每分钟这个分数就会掉$d_a$分。第二道题最开始有$b$分,然后每分钟这个分数就会掉$d_b$分。而且,一旦这道比赛的零分钟结束时,第一道题就会有$a - d_a$分,然后第二题会有$b - d_b$分。保证比赛过程中的分值全是非负数。 阿卡狄要你确认珐乐菈能不能在这个比赛中得到$x$分。你能认为珐乐菈每道题能得任意分数。你也可以认为任何问题珐乐菈只交了一次,而且,在0分钟和$t-1$分钟之间,他可能同时提交了两道题。注意:在$t$分钟时他不能提交代码。 输入格式: 一行,包含六个数$x,t,a,b,d_a,d_b$($0\le x\le 600$, $1\le t,a,b,d_a,d_b\le 300$),分别表示珐乐菈的成绩、比赛时长、第一道题的初始分数、第二道题的初始分数、第一道和第二道题每分钟减少多少分。 输出格式: 如果珐乐菈能正好得到$x$分的话,输出"YES",反之,输出"NO"(不加引号)。 在第一个样例里他可能这样做的:他在0分钟时提交了第一题,然后在第2分钟时提交了第二题。所以他第一题得了20分,第二题得了10分。加起来总共就得了30分

题目描述

A boy Valera registered on site Codeforces as Valera, and wrote his first Codeforces Round #300. He boasted to a friend Arkady about winning as much as $ x $ points for his first contest. But Arkady did not believe his friend's words and decided to check whether Valera could have shown such a result. He knows that the contest number $ 300 $ was unusual because there were only two problems. The contest lasted for $ t $ minutes, the minutes are numbered starting from zero. The first problem had the initial cost of $ a $ points, and every minute its cost reduced by $ d_{a} $ points. The second problem had the initial cost of $ b $ points, and every minute this cost reduced by $ d_{b} $ points. Thus, as soon as the zero minute of the contest is over, the first problem will cost $ a-d_{a} $ points, and the second problem will cost $ b-d_{b} $ points. It is guaranteed that at any moment of the contest each problem has a non-negative cost. Arkady asks you to find out whether Valera could have got exactly $ x $ points for this contest. You should assume that Valera could have solved any number of the offered problems. You should also assume that for each problem Valera made no more than one attempt, besides, he could have submitted both problems at the same minute of the contest, starting with minute $ 0 $ and ending with minute number $ t-1 $ . Please note that Valera can't submit a solution exactly $ t $ minutes after the start of the contest or later.

输入输出格式

输入格式


The single line of the input contains six integers $ x,t,a,b,d_{a},d_{b} $ $ (0<=x<=600; 1<=t,a,b,d_{a},d_{b}<=300) $ — Valera's result, the contest's duration, the initial cost of the first problem, the initial cost of the second problem, the number of points that the first and the second problem lose per minute, correspondingly. It is guaranteed that at each minute of the contest each problem has a non-negative cost, that is, $ a-i·d_{a}>=0 $ and $ b-i·d_{b}>=0 $ for all $ 0<=i<=t-1 $ .

输出格式


If Valera could have earned exactly $ x $ points at a contest, print "YES", otherwise print "NO" (without the quotes).

输入输出样例

输入样例 #1

30 5 20 20 3 5

输出样例 #1

YES

输入样例 #2

10 4 100 5 5 1

输出样例 #2

NO

说明

In the first sample Valera could have acted like this: he could have submitted the first problem at minute $ 0 $ and the second problem — at minute $ 2 $ . Then the first problem brings him $ 20 $ points and the second problem brings him $ 10 $ points, that in total gives the required $ 30 $ points.

Input

题意翻译

一个男孩珐乐菈在CF注册了一个账号叫做珐乐菈,然后做了他的第一个比赛#300。他跟他的朋友阿卡狄炫耀在他的第一个比赛里他得了$x$分。但是阿卡狄并不相信他朋友的话,然后决定去查珐乐菈能不能的这样的分数。 他知道比赛编号$300$很不寻常因为这个比赛只有两道题。这次比赛进行了$t$秒,时间是从0分开始计数。第一道题最开始有$a$分,然后每分钟这个分数就会掉$d_a$分。第二道题最开始有$b$分,然后每分钟这个分数就会掉$d_b$分。而且,一旦这道比赛的零分钟结束时,第一道题就会有$a - d_a$分,然后第二题会有$b - d_b$分。保证比赛过程中的分值全是非负数。 阿卡狄要你确认珐乐菈能不能在这个比赛中得到$x$分。你能认为珐乐菈每道题能得任意分数。你也可以认为任何问题珐乐菈只交了一次,而且,在0分钟和$t-1$分钟之间,他可能同时提交了两道题。注意:在$t$分钟时他不能提交代码。 输入格式: 一行,包含六个数$x,t,a,b,d_a,d_b$($0\le x\le 600$, $1\le t,a,b,d_a,d_b\le 300$),分别表示珐乐菈的成绩、比赛时长、第一道题的初始分数、第二道题的初始分数、第一道和第二道题每分钟减少多少分。 输出格式: 如果珐乐菈能正好得到$x$分的话,输出"YES",反之,输出"NO"(不加引号)。 在第一个样例里他可能这样做的:他在0分钟时提交了第一题,然后在第2分钟时提交了第二题。所以他第一题得了20分,第二题得了10分。加起来总共就得了30分

加入题单

算法标签: