#include
#include
#define DEBUG 0
int main()
{
int done;
int found;
int a,b,x,y;
int c,d;
int i,j;
printf("Problem 6 by team X\n");
done=0;
while(!done) {
fscanf(stdin,"%d %d %d %d",&a,&b,&x,&y);
#if DEBUG
printf("%d %d %d %d\n",a,b,x,y);
#endif
/* stop on the line that contains 0's */
if (a==0) {
done=1;
break;
}
/* check for horizontal orientation of the
tiles, and for vertical orientation of the
tiles
*/
if (((a%x==0) && (b%y==0)) ||
((a%y==0) && (b%x==0))) {
printf("yes\n");
} else {
/* ok, what if we do some oriented
horizontally, and some vertically?
*/
if (((a*b)%(x*y))!=0) {
/* no hope... the area in the room
can't be evenly covered by the
tiles no matter how they are
aligned. */
printf("no\n");
} else {
/* impossible to "mix" orientations on
both sides, so we consider each
side separately...
*/
if ((a%x==0) && (a%y==0)) {
/* 'a' is the 'perfect width',
and will accommodate both
tiles evenly. now... can
we fit the tiles evenly
along 'b' as well? */
found=0;
for (i=0;i