Advertisement
alexon5519

9-programare

Dec 1st, 2017
93
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.41 KB | None | 0 0
  1. #include<iostream>
  2. #include<fstream>
  3.  
  4. using namespace std;
  5.  
  6.  
  7. int main(){
  8. ifstream f1("atestat.in");
  9. ofstream f2("atestat.out");
  10. int n,k,y,z=0,OK=0,q;
  11. f1>>n>>k;
  12. y=n;
  13. while(y!=0){
  14. if(y%10!=k)
  15. z=z*10+y%10;
  16. y=y/10;
  17. }
  18. while(z!=0){
  19. y=y*10+z%10;
  20. z=z/10;
  21. }
  22. z=1;
  23. f2<<y<<endl;
  24. while(OK==0){
  25. z = z * k;
  26. if(z > n)
  27. OK=1;
  28. }
  29. f2<<z/2;
  30. f2.close();
  31. f1.close();}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement