Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- problema 1582
- #include <iostream>
- using namespace std;
- int main()
- {
- long long n,a,mx=0,mn=100000000,s=0,x,y,d,c;
- cin>>n;
- while (n){
- cin>>a;
- s=0;
- x=a;
- y=a;
- while (a){
- s=s+(a%10);
- a/=10;
- }
- if (s<mn){
- mn=s;
- d=x;
- }
- if (s>mx){
- mx=s;
- c=y;
- }
- n--;
- }
- cout<<d<<endl;
- cout<<c;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement