Submission #3217813
Source Code Expand
// Copyright (C) 2018 Skqliao. All rights served.
#include <bits/stdc++.h>
#define rep(i, l, r) for (__typeof(l) i = (l), _##i##_ = (r); i < _##i##_; ++i)
#define rof(i, l, r) for (__typeof(l) i = (l) - 1, _##i##_ = (r); i >= _##i##_; --i)
#define irep(i, x) for (__typeof(x.begin()) i = x.begin(); i != x.end(); ++i)
#define ALL(x) (x).begin(), (x).end()
#define SZ(x) static_cast<int>((x).size())
typedef long long ll;
typedef std::pair<int, int> pii;
template<typename T> inline bool chkMin(T &a, const T &b) { return a > b ? a = b, 1 : 0; }
template<typename T> inline bool chkMax(T &a, const T &b) { return a < b ? a = b, 1 : 0; }
int N, K;
int main() {
scanf("%d%d", &N, &K);
if(K == 0) {
printf("%lld\n", (ll)N * N);
return 0;
}
ll res = 0;
rep(i, K + 1, N + 1) {
res += (N / i) * (i - K);
if(N % i >= K) {
res += N % i - K + 1;
}
}
printf("%lld\n", res);
return 0;
}
Submission Info
Submission Time
2018-09-18 00:30:56+0900
Task
D - Remainder Reminder
User
Skqliao
Language
C++ (GCC 5.4.1)
Score
400
Code Size
928 Byte
Status
AC
Exec Time
1 ms
Memory
256 KB
Compile Error
./Main.cpp: In function ‘int main()’:
./Main.cpp:17:23: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
scanf("%d%d", &N, &K);
^
Judge Result
Set Name
Sample
All
Score / Max Score
0 / 0
400 / 400
Status
Set Name
Test Cases
Sample
s1.txt, s2.txt, s3.txt
All
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
AC
1 ms
256 KB
02.txt
AC
1 ms
256 KB
03.txt
AC
1 ms
256 KB
04.txt
AC
1 ms
256 KB
05.txt
AC
1 ms
256 KB
06.txt
AC
1 ms
256 KB
07.txt
AC
1 ms
256 KB
08.txt
AC
1 ms
256 KB
09.txt
AC
1 ms
256 KB
10.txt
AC
1 ms
256 KB
11.txt
AC
1 ms
256 KB
s1.txt
AC
1 ms
256 KB
s2.txt
AC
1 ms
256 KB
s3.txt
AC
1 ms
256 KB