fork download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. int main() {
  5. long long int a,b,x,k;
  6. cin >> a >> b >> x;
  7. if ( (a%x==0) or (b%x==0) or (a%x > b%x )) k= (b-a)/x +1;
  8. else k= (b-a)/x;
  9. cout << k;
  10. return 0;
  11. }
Success #stdin #stdout 0s 15232KB
stdin
13 42   7
stdout
5