Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<iostream>
- #include<fstream>
- using namespace std;
- int main(){
- ifstream f1("atestat.in");
- ofstream f2("atestat.out");
- int x,y,ok,nr=0,i=0,v[100],a,b[9],j;
- while(f1>>x){
- i++;
- v[i]=x;
- y=x;
- ok=0;
- while(y != 0 && ok == 0){
- if(y % 10 == 0){
- nr++;
- ok=1;
- }
- y=y/10;
- }
- }
- f2<<nr<<endl;
- x=v[1];
- ok=0;
- for(j=2;j<=i && ok == 0;j++){
- a=1;
- while(x != 0 && ok == 0 ){
- b[a]=x;
- if(b[a] == v[j]){
- ok=1;
- f2<<b[1]<<" "<<v[j];
- }
- a++;
- x=x/10;
- }
- x=v[j];
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement