Skip to content

Instantly share code, notes, and snippets.

@meooow25
Created February 26, 2019 03:33
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save meooow25/318c6b660e6b6d17b5509dec44aa54ab to your computer and use it in GitHub Desktop.
Save meooow25/318c6b660e6b6d17b5509dec44aa54ab to your computer and use it in GitHub Desktop.
// CLBATH
// Tester: avijit_agarwal
import java.io.*;
class Solution
{
public static void main(String[] args)throws IOException
{
FastReader in=new FastReader(System.in);
StringBuilder sb=new StringBuilder();
int t=in.nextInt();
while(t-->0)
{
int t1,v1,t2,v2,t3,v3;
v1=in.nextInt();
t1=in.nextInt();
v2=in.nextInt();
t2=in.nextInt();
v3=in.nextInt();
t3=in.nextInt();
double x,y;
x=((double)t3-t2)/(t1-t2);
x=x*v3;
y=v3-x;
if(x<0 || y<0 || x>v1 || y>v2)
sb.append("NO\n");
else
sb.append("YES\n");
}
System.out.print(sb);
}
}
class FastReader {
byte[] buf = new byte[2048];
int index, total;
InputStream in;
FastReader(InputStream is) {
in = is;
}
int scan() throws IOException {
if (index >= total) {
index = 0;
total = in.read(buf);
if (total <= 0) {
return -1;
}
}
return buf[index++];
}
String next() throws IOException {
int c;
for (c = scan(); c <= 32; c = scan());
StringBuilder sb = new StringBuilder();
for (; c > 32; c = scan()) {
sb.append((char) c);
}
return sb.toString();
}
String nextLine() throws IOException {
int c;
for (c = scan(); c <= 32; c = scan());
StringBuilder sb = new StringBuilder();
for (; c !=10 && c!=13; c = scan()) {
sb.append((char) c);
}
return sb.toString();
}
char nextChar() throws IOException{
int c;
for (c = scan(); c <= 32; c = scan());
return (char)c;
}
int nextInt() throws IOException {
int c, val = 0;
for (c = scan(); c <= 32; c = scan());
boolean neg = c == '-';
if (c == '-' || c == '+') {
c = scan();
}
for (; c >= '0' && c <= '9'; c = scan()) {
val = (val << 3) + (val << 1) + (c & 15);
}
return neg ? -val : val;
}
long nextLong() throws IOException {
int c;
long val = 0;
for (c = scan(); c <= 32; c = scan());
boolean neg = c == '-';
if (c == '-' || c == '+') {
c = scan();
}
for (; c >= '0' && c <= '9'; c = scan()) {
val = (val << 3) + (val << 1) + (c & 15);
}
return neg ? -val : val;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment