-
Notifications
You must be signed in to change notification settings - Fork 0
/
1238a.c
50 lines (46 loc) · 1 KB
/
1238a.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
#include <stdio.h>
int isPrime(int number) {
int i;
for (i=2; i<number; i++) {
if (number % i == 0 && i != number) return 0;
}
return 1;
}
int main ()
{
int t;
int t_counter;
scanf("%d", &t);
for (t_counter=0; t_counter<t; t_counter++){
unsigned long long x, y;
unsigned long long k;
scanf("%llu", &x);
scanf("%llu", &y);
//printf("x=%llu and y=%llu\n", x, y);
if (x-1==y){
printf("NO\n");
continue;
}
if (y==1 && x%2==1){
printf("YES\n");
continue;
}
int found = 0;
for(k=0; k<x; k++){
if (isPrime(k))
{
if ((x - y)/k % 1 == 0)
{
//print((x-y)/k %1)
printf("YES\n");
found = 1;
break;
}
}
}
if (found==0){
printf("NO\n");
}
}
return 0;
}