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 main() { long long z, c; cin >> z >> c; long long najmal = 1, najgolem; for(int i = 0; i < c - 1; i++) { najmal *= 10; } najgolem = najmal * 10 - 1; long long L = najmal, R = najgolem; long long zbir, broj; while(L <= R) { long long sredina = (L + R) / 2; broj = sredina; zbir = 0; while(broj > 0) { zbir += broj; broj /= 10; } if(zbir == z) { cout << sredina << endl; return 0; } if(zbir < z) { L = sredina + 1; } else { R = sredina - 1; } } 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)