题目链接:点击打开链接
#include<stdio.h> #include<algorithm> #include<string.h> using namespace std; int main() { char st[1000010]; int a[100010],m,n,t,i,j,l,s,ll; ll=0; scanf("%d",&t); getchar(); while(t--) { gets(st); l=strlen(st); s=0; for(i=0;i<l;i++) { if(st[i]==' ') { if(s!=0) { a[ll]=s; ll++; s=0; } } else { s=s*10+(st[i]-'0'); } } if(s!=0) a[ll++]=s; } sort(a,a+ll); for(i=1;i<ll;i++) { if(a[i]-a[i-1]==2) m=a[i]-1; if(a[i]==a[i-1]) n=a[i]; } printf("%d %d\n",m,n); return 0; }
转载请注明原文地址: https://ju.6miu.com/read-8455.html