Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <bits/stdc++.h>
- using namespace std;
- int main(){
- int m_1,m_2,m_3;
- int temp;
- int dem = 0;
- m_1=m_2=m_3=INT_MIN;
- while(cin>>temp){
- if (temp>m_1)
- {
- m_3=m_2;
- m_2=m_1;
- m_1=temp;
- }
- else{
- if(temp>m_2)
- {
- m_3=m_2;
- m_2=temp;
- }
- else
- {
- if (temp>m_3)
- m_3=temp;
- }
- }
- dem++;
- }
- if (dem==1) cout<<m_1;
- else
- if (dem==2) cout<<m_1<<" "<<m_2;
- else cout<< m_1<<" "<<m_2<<" "<<m_3;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement