Advertisement
alex326

Untitled

Jan 21st, 2018
64
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.46 KB | None | 0 0
  1. problema 1582
  2.  
  3. #include <iostream>
  4. using namespace std;
  5. int main()
  6. {
  7. long long n,a,mx=0,mn=100000000,s=0,x,y,d,c;
  8. cin>>n;
  9. while (n){
  10. cin>>a;
  11. s=0;
  12. x=a;
  13. y=a;
  14. while (a){
  15. s=s+(a%10);
  16. a/=10;
  17. }
  18. if (s<mn){
  19. mn=s;
  20. d=x;
  21. }
  22. if (s>mx){
  23. mx=s;
  24. c=y;
  25. }
  26. n--;
  27. }
  28. cout<<d<<endl;
  29. cout<<c;
  30. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement