Advertisement
a53

placare1

a53
Jul 9th, 2017
114
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.34 KB | None | 0 0
  1. #include <fstream>
  2. using namespace std;
  3. ifstream f("placare1.in");
  4. ofstream g("placare1.out");
  5. long long int L,A,B,H,r,n;
  6.  
  7. int main()
  8. {
  9. f>>L>>A>>B;
  10. r=L%A,n=1;
  11. while(r!=0)
  12. r=(L-(A-r))%A,++n;
  13. H=n*B;
  14. r=L%B,n=1;
  15. while(r!=0)
  16. r=(L-(B-r))%B,++n;
  17. if(n*A>H)
  18. H=n*A;
  19. g<<H;
  20. return 0;
  21. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement