AcWing 1204. 错误票据
#include<iostream> #include<algorithm> #include<sstream> #include<string> #include<algorithm> using namespace std; int n=0; const int N=10010; int a[N]; int main() { int t; cin>> t; string s; getline(cin,s); while(t--) { getline(cin,s); stringstream ssin(s); while(ssin>>a[n])n++; } int j,k; sort(a,a+n); for(int i=1;i<n;i++) { if(a[i]-a[i-1]==2)j=a[i]-1; if(a[i]==a[i-1])k=a[i]; } cout<<j<<" "<<k<<endl; return 0; }难点:输入方式