Search
Duplicate

더하기 사이클

주차
0
문제번호
1110
언어
C++
티어
브론즈
유형
구현
문자열
nj_Blog
nj_상태
이해도
풀이
사람
이해도 2
13 more properties

Code

제출 날짜

@5/15/2021

메모리

2020 KB

시간

0 ms
#include <iostream> #include <string> std::string N; void io_faster() { std::ios_base::sync_with_stdio(false); std::cin.tie(0); std::cout.tie(0); } void input() { io_faster(); std::cin >> N; } void solve() { int i = 1; std::string a, b, c; if (N.size() < 2) N = "0" + N; b = N; while(true) { a = ""; c = std::to_string((int)(b[0] - '0') + (int)(b[1] - '0')); a += b[1]; a += c.back(); if (a == N) { std::cout << i; break; } b = a; i++; } } int main() { input(); solve(); return (0); }
C++
복사