Advertisement
Korotkodul

vf

Nov 11th, 2021
69
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.90 KB | None | 0 0
  1. /******************************************************************************
  2.  
  3. Online C++ Compiler.
  4. Code, Compile, Run and Debug C++ program online.
  5. Write your code in this editor and press "Run" button to compile and execute it.
  6.  
  7. *******************************************************************************/
  8.  
  9. #include <iostream>
  10.  
  11. using namespace std;
  12.  
  13. int main()
  14. {
  15. int lx = 7;
  16. int ly = 10;
  17. int lz = 17;
  18. int S = (lx + ly + lz);
  19. for (int K = 0; K < 1000;++K){
  20. int one = K * S;
  21. int add = S / 8;
  22. if (S % 8 != 0) add++;
  23. one += K * add;
  24.  
  25. int two = K * S;
  26. int plus = (K*S) / 8;
  27. if ( (K*S) % 8 != 0) plus++;
  28. two += K * plus;
  29.  
  30. if (two - one == 26 * 8){
  31. cout<<"K min = "<<K<<'\n';
  32. break;
  33. }
  34. }
  35.  
  36.  
  37. }
  38.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement