Varianta 9 / Subiectul 3 / Problema 4 |
#include<fstream.h> ifstream fin("numere.in"); long f[1000]; void main() { long k; int x,y; while(fin>>k) if(k>=100 && k<=999) f[k]++; x=999; while(f[x]>0) x--; if(x>100) { y=x-1; while(f[y]>0) y--; } if(x>=100 && y>=100) cout<<x<<" "<<y; else cout<<0; } |