fork(1) download
  1. #include<iostream>
  2. using namespace std;
  3. long long n, k, sum;
  4. int main() {
  5. cin >> n >> k;
  6. for (int i = 2; i <= 6; i++) {
  7. long long S = 0;
  8. for (int j = 2; j <= n - 1; j++) {
  9. long long P = j * 7 + i - 7; P *= 9;
  10. if (P % 11 == k) { S = j; break; }
  11. }
  12. if (S == 0)continue;
  13. sum += ((n - 1) - S) / 11 + 1;
  14. }
  15. cout << sum << endl;
  16. return 0;
  17. }
Success #stdin #stdout 0s 3464KB
stdin
100 8
stdout
45