Guest User

Untitled

a guest
Jun 22nd, 2018
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.74 KB | None | 0 0
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5. int main() {
  6. int a, b;
  7. int sum=0;
  8. cin >> a >> b;
  9. for (int i = a; i <= b; ++i) {
  10. if (i % 7 ==0) {
  11. i++;
  12. cout << sum << ' ';
  13. }
  14. }
  15. return 0;
  16. }
  17.  
  18. #include <iostream>
  19.  
  20. using namespace std;
  21.  
  22. int main() {
  23. int a, b;
  24. int number = 0;
  25. cin >> a >> b;
  26. for (int i = a; i <= b; i++) {
  27. if (i % 7 == 0) {
  28. number++;
  29. cout << i << ' ';
  30. }
  31. }
  32.  
  33. cout << "n";
  34. cout << "number: " << number << "n";
  35.  
  36. return 0;
  37. }
  38.  
  39. int deltaA = (a % 7 == 0)? 0 : (7 - (a % 7));
  40. int count = (b - (b % 7) - (a + deltaA)) / 7 + 1;
  41. if (count < 0)
  42. count = 0;
  43.  
  44. a = a + 6 / 7 * 7;
  45.  
  46. b = b / 7 * 7;
  47.  
  48. n = (b - a) / 7 + 1;
Add Comment
Please, Sign In to add comment