Submission #27856809


Source Code Expand

#include <iostream>
using namespace std;

long long N;

int main() {
  cin >> N;

  // long long ans1 = 0;
  // for (int i = 1; i <= N; i++) {
  //   ans1 += N/i;
  // }
  // cout << ans1 << endl;

  long long ans2 = 0;
  long long i = 1;
  while (i <= N) {
    long long k = N/i;
    ans2 += (N/k - i + 1) * k;
    i = N/k+1;
  }
  cout << ans2 << endl;
}

Submission Info

Submission Time
Task E - Fraction Floor Sum
User daimatz
Language C++ (GCC 9.2.1)
Score 500
Code Size 380 Byte
Status AC
Exec Time 61 ms
Memory 3584 KiB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 500 / 500
Status
AC × 2
AC × 22
Set Name Test Cases
Sample example_00.txt, example_01.txt
All example_00.txt, example_01.txt, random_00.txt, random_01.txt, random_02.txt, random_03.txt, random_04.txt, random_05.txt, random_06.txt, random_07.txt, random_08.txt, random_09.txt, random_10.txt, random_11.txt, random_12.txt, random_13.txt, random_14.txt, random_15.txt, random_16.txt, random_17.txt, random_18.txt, random_19.txt
Case Name Status Exec Time Memory
example_00.txt AC 8 ms 3576 KiB
example_01.txt AC 8 ms 3560 KiB
random_00.txt AC 61 ms 3584 KiB
random_01.txt AC 57 ms 3508 KiB
random_02.txt AC 58 ms 3520 KiB
random_03.txt AC 3 ms 3428 KiB
random_04.txt AC 2 ms 3416 KiB
random_05.txt AC 2 ms 3560 KiB
random_06.txt AC 40 ms 3428 KiB
random_07.txt AC 33 ms 3428 KiB
random_08.txt AC 20 ms 3576 KiB
random_09.txt AC 44 ms 3576 KiB
random_10.txt AC 53 ms 3388 KiB
random_11.txt AC 55 ms 3432 KiB
random_12.txt AC 41 ms 3508 KiB
random_13.txt AC 42 ms 3524 KiB
random_14.txt AC 58 ms 3556 KiB
random_15.txt AC 57 ms 3572 KiB
random_16.txt AC 56 ms 3524 KiB
random_17.txt AC 56 ms 3428 KiB
random_18.txt AC 57 ms 3428 KiB
random_19.txt AC 55 ms 3556 KiB