Archives
Trending
Support
Login
clear text
XML
Django
JavaScript
MATLAB
C
C++
C#
Python
SQL
Shell
Bash
Markdown
YAML
JSON
HTML
CSS
PHP
Java
Ruby
Go
Rust
Swift
Kotlin
Arduino
TypeScript
Perl
Autohotkey
Lua
SQF
R
Scala
Haskell
Groovy
Dart
Clojure
VB.NET
Objective-C
PowerShell
Bash
CoffeeScript
Verilog
#include
using namespace std; int broj_na_deliteli(int n, int idx) { if(idx > n) { return 0; } bool deliv = ((n % idx) == 0); return broj_na_deliteli(n, idx + 1) + deliv; } int k_deliv(int x, int idx, int k) { if(idx < x - k or idx == 0) { return 1; } if(broj_na_deliteli(idx, 1) >= broj_na_deliteli(x, 1)) { return 0; } return k_deliv(x, idx - 1, k); } int sum(int a, int b, int k) { if(a > b) { return 0; } int dodadi = 0; if(k_deliv(a, a - 1, k)) { dodadi = a; } return sum(a + 1, b, k) + dodadi; } int main() { int a, b, k; cin >> a >> b >> k; cout << sum(a, b, k) << endl; return 0; }
Mark as private (unlisted)
for 30 minutes
for 6 hours
for 1 day
for 1 week
for 1 month
for 1 year
everlasting (like CCCP)