Advertisement
alexon5519

12-3

Oct 26th, 2017
65
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.37 KB | None | 0 0
  1. #include<iostream.h>
  2. #include<fstream.h>
  3. int main(){
  4. ifstream f1("BAC.TXT");
  5. int n,m,v[100],i=0,x,s,t=0,y,ok;
  6. f1>>m>>n;
  7. while(i<m){
  8. f1>>x;
  9. i++;
  10. v[i]=x;}
  11. while(f1>>x){
  12. s=0;
  13. y=0;
  14. ok=0;
  15. for(i=1;i<=m && ok==0;i++){
  16. if(v[i]!=x)
  17. s++;
  18. y++;
  19. if(y!=s)
  20. ok=1;}
  21. if (s==m){
  22. cout<<x<<" ";
  23. t++;}}
  24. cout<<endl<<t;}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement