View Code of Problem 6

#include<stdio.h>
main(){
	int t,n,a[100],b[100];
	int i,d,count=1;
	scanf("%d",&t);
	while(t--){
		scanf("%d",&n);
		for(i=0;i<n;i++)
			scanf("%d%d",&a[i],&b[i]);
		d=b[0]-a[0];
		for(i=1;i<n;i++){
			if(b[i]-a[i]==d)
				count++;
		}
		if(count==n)
			printf("YES\n");
		else
			printf("NO\n");
		count=1;
	}
}

Double click to view unformatted code.


Back to problem 6