Submission #2185835


Source Code Expand

Copy
#include <cstdio>
#include <iostream>
using namespace std;

int n, k;

int main() {
  int n, k;
  long long ans = 0;
  cin >> n >> k;
  for (int i = k + 1; i <= n; i ++) {
    int l, r;
    for (int w = 0; w <= n; w ++) {
      l = max(i * w + k, 1); r = min(i * w + i - 1, n);
      if (l > n) break;
      ans += r - l + 1;
      if (r == n) break;
    }
  }
  cout << ans << endl;
  return 0;
}

Submission Info

Submission Time
Task D - Remainder Reminder
User The_Unbeatable
Language C++14 (GCC 5.4.1)
Score 400
Code Size 420 Byte
Status
Exec Time 4 ms
Memory 256 KB

Judge Result

Set Name Score / Max Score Test Cases
Sample 0 / 0 s1.txt, s2.txt, s3.txt
All 400 / 400 01.txt, 02.txt, 03.txt, 04.txt, 05.txt, 06.txt, 07.txt, 08.txt, 09.txt, 10.txt, 11.txt, s1.txt, s2.txt, s3.txt
Case Name Status Exec Time Memory
01.txt 4 ms 256 KB
02.txt 3 ms 256 KB
03.txt 1 ms 256 KB
04.txt 2 ms 256 KB
05.txt 4 ms 256 KB
06.txt 3 ms 256 KB
07.txt 1 ms 256 KB
08.txt 1 ms 256 KB
09.txt 3 ms 256 KB
10.txt 1 ms 256 KB
11.txt 1 ms 256 KB
s1.txt 1 ms 256 KB
s2.txt 1 ms 256 KB
s3.txt 1 ms 256 KB