fork download
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5. int main(){
  6. long long x, y; cin >> x >> y;
  7. int cnt= 0;
  8. long long j= 8;
  9. for(long long i= x; i<= x+y-1; i++){
  10. cnt++;
  11. if(i%7== 0){
  12. cnt-=1;
  13. }
  14. if(i== j){
  15. j+= 7;
  16. cnt-=1;
  17. }
  18. }
  19. cout << cnt;
  20. return 0;
  21. }
Success #stdin #stdout 0.02s 25784KB
stdin
Standard input is empty
stdout
#include <iostream>
 
using namespace std;
 
int main(){
    long long x, y; cin >> x >> y;
    int cnt= 0;
    long long j= 8;
    for(long long i= x; i<= x+y-1; i++){
        cnt++;
        if(i%7== 0){
            cnt-=1;
        }
        if(i== j){
            j+= 7;
            cnt-=1;
        }
    }
    cout << cnt;
    return 0;
}