Submission #3718512
Source Code Expand
#include <iostream> #include <sstream> #include <algorithm> #include <string> #include <vector> #include <map> #include <set> #include <queue> #include <deque> #include <stack> #include <memory> #include <complex> #include <numeric> #include <cstdio> #include <iomanip> #define REP(i,m,n) for(int i=int(m);i<int(n);i++) #define RREP(i,m,n) for(int i=int(n)-1;i>=int(m);--i) #define EACH(i,c) for (auto &(i): c) #define all(c) begin(c),end(c) #define EXIST(s,e) ((s).find(e)!=(s).end()) #define SORT(c) sort(begin(c),end(c)) #define pb emplace_back #define MP make_pair #define SZ(a) int((a).size()) #ifdef LOCAL #define DEBUG(s) cout << (s) << endl #define dump(x) cerr << #x << " = " << (x) << endl #define BR cout << endl; #else #define DEBUG(s) do{}while(0) #define dump(x) do{}while(0) #define BR #endif using namespace std; using UI = unsigned int; using UL = unsigned long; using LL = long long int; using ULL = unsigned long long; using VI = vector<int>; using VVI = vector<VI>; using VLL = vector<LL>; using VS = vector<string>; using PII = pair<int,int>; using VP = vector<PII>; //struct edge {int from, to, cost;}; constexpr double EPS = 1e-10; //constexpr double PI = acos(-1.0); //constexpr int INF = INT_MAX; constexpr int MOD = 1'000'000'007; template<class T> inline T sqr(T x) {return x*x;} void solve() { int n,k; cin >> n >> k; LL ans = 0; REP(b,k+1,n+1) { int mod = n % b; ans += max(0, mod - k + 1); ans += max(0LL, (LL)(n - mod) * (b - k) / b); if (k == 0) ans -= 1; } cout << ans << endl; } int main() { solve(); return 0; }
Submission Info
Submission Time | |
---|---|
Task | D - Remainder Reminder |
User | unsre |
Language | C++14 (GCC 5.4.1) |
Score | 400 |
Code Size | 1700 Byte |
Status | AC |
Exec Time | 3 ms |
Memory | 256 KB |
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 | 3 ms | 256 KB |
02.txt | AC | 3 ms | 256 KB |
03.txt | AC | 2 ms | 256 KB |
04.txt | AC | 2 ms | 256 KB |
05.txt | AC | 3 ms | 256 KB |
06.txt | AC | 3 ms | 256 KB |
07.txt | AC | 1 ms | 256 KB |
08.txt | AC | 2 ms | 256 KB |
09.txt | AC | 3 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 | 2 ms | 256 KB |