Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<iostream>
- #include<cmath>
- #include<fstream>
- using namespace std;
- ifstream fin("bac1.txt.cpp");
- int suma(int x)
- {
- int spar=0,simp=0,c;
- while(x!=0)
- {
- c=x%10;
- if(c%2==0) spar=spar+c;
- else simp=simp+c;
- x=x/10;
- }
- if(spar==simp) return 1;
- else return 0;
- }
- int main()
- {
- int x,ap=0,minim=INT_MAX;
- while(fin>>x)
- {
- if(suma(x)==1)
- {
- if(x<minim)
- {
- minim=x;
- ap=1;
- }
- else
- {
- if(x==minim) ap++;
- }
- }
- }
- cout<<minim<<" "<<ap;
- }
- //22031 9021 22031 1021 2011 10012 1021 457008 99882
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement