View Code of Problem 83

#include<stdio.h>
#include <string.h>
#include <math.h>
int main(){
	int a[100];
	int b[100];
	int i,j;
	int m,n;
	int min,max,t;
	scanf("%d %d",&m,&n);
	for(i=0;i<m;i++){
		scanf("%d %d",&a[i],&b[i]);
	} 
	for(i=m;i<n+m;i++){
		scanf("%d %d",&a[i],&b[i]);
	} 
	for(i=0;i<m+n;i++){
		for(j=i;j<m+n;j++){
			if(a[i]>a[j]){
				t=a[i];
				a[i]=a[j];
				a[j]=t;
				t=b[i];
				b[i]=b[j];
				b[j]=t;
			}
		}
	}
	for(i=0;i<m+n;i++){
		printf("%d ",a[i]);
		printf("%d\n",b[i]);
	}
	
	printf("\n");
	return 0;
}

Double click to view unformatted code.


Back to problem 83