Răspuns :
Răspuns:
#include <iostream>
#include <fstream>
using namespace std;
ifstream f("bac.in");
int main()
{
int x,a,b,c,ok=0,ok1=0,ok2=0;
while(f>>x)
{
if(x%100==20)
{
if(ok2==0)
{if(ok==0)
{a=x;
ok=1;
}
else
if(ok1==0)
{
if(a<x)
{
b=a;
a=x;
}
else
b=x;
ok1=1;
}
else
{
if(b<x)
{
c=b;
b=x;
}
else
c=x;
ok2=1;
}
}
else
{
if(a<=x)
{
c=b;
b=a;
a=x;
}
else
{
if(b<=x)
{
c=b;
b=x;
}
else
if(c<x)
c=x;
}
}
}
}
cout<<c<<" "<<b<<" "<<a;
return 0;
}
Explicație: