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; int main() { string n; cin >> n; int f = (n[0] - '0'); int s = (n[1] - '0'); int t = (n[2] - '0'); for(int i = 0; i < 1000; i++) { int tmp = t; t = (t + s + f) % 10; n += (t + '0'); int sz = (int) n.size(); if(n[0] == n[sz - 3] and n[1] == n[sz - 2] and n[2] == n[sz - 1]) { n.erase(n.end() - 1); n.erase(n.end() - 1); n.erase(n.end() - 1); break; } f = s; s = tmp; } long long K; cin >> K; int sz = (int) n.size(); long long pos = K % sz; if(pos == 0) { cout << n[sz - 1] << endl; } else { cout << n[pos - 1] << 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)