1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 |
#include <iostream> #include <sstream> #include <stdio.h> #include <string> #include <math.h> using namespace std; int main() { int n; double max_,min_; double day,month,yr; string s,name,young,old; stringstream ss; bool f=false; cin>>n; //getchar(); while(n--) { cin>>name>>day>>month>>yr; yr+=((month/12)+(day/365)); if(!f) { max_=yr; young = name; min_=yr; old = name; f=1; } else { if(yr>max_) { max_=yr; young = name; } if(yr<min_) { min_=yr; old = name; } } } cout<<young<<"\n"<<old<<"\n"; //cin>>old; return 0; } |