View Code of Problem 10

#include <stdio.h>

int main ()
{
	int t,i,a[4],b[4];
	
	scanf ("%d",&t);
	while (t--){
		for (i=0;i<4;i++)
		    scanf ("%d",&a[i]);
		if (a[3] == a[2]){
			b[3] = a[3]*2;
			if (a[1] == a[0]) {
				b[2] = a[0]*2;
				b[1] = b[0] = 0;
			}
			else {
				b[2] = a[1];
				b[1] = a[0];
				b[0] = 0;
			}
		}
		else {
			if (a[2] == a[1]){
				b[3] = a[3];
				b[2] = a[2]*2;
				b[1] = a[0];
				b[0] = 0;
			}
			else if (a[2]!=a[1]&&a[1]==a[0]){
				b[3] = a[3];
				b[2] = a[2];
				b[1] = a[1]*2;
				b[0] = 0;
			}
			else {
				for (i=0;i<4;i++)
				    b[i] = a[i];
			}
		}
		for (i=0;i<3;i++)
		    printf ("%d ",b[i]);
		printf ("%d\n",b[i]);
	}
	return 0;
}

Double click to view unformatted code.


Back to problem 10