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
#include
#include
#include
#include
#include
#include
using namespace std; typedef long long ll; const int INF = 1e9; int main() { ios_base::sync_with_stdio(false); // ifstream cin("in.txt"); int q; cin >> q; while(q--) { ll k; cin >> k; if(k <= 9) { cout << k << endl; continue; } ll power_of_9 = 9; ll sum = 0; ll digits = 1; ll current_pow = 1; while(sum + (power_of_9 * digits) <= k) { sum += (power_of_9 * digits); power_of_9 *= 10; digits++; current_pow *= 10; } if(k == sum) { cout << 9 << endl; continue; } k--; current_pow += (k - sum) / digits; ll rem = ((k - sum) % digits); rem = digits - rem; rem -= 1; while(rem--) { current_pow /= 10; } cout << (current_pow % 10) << endl; } return 0; } // 9 + 180
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)