Algorithm/백준
C++ 알고리즘 - 백준 1748 수 이어 쓰기 1
마루설아
2025. 1. 19. 21:05
https://www.acmicpc.net/problem/1748
#include <bits/stdc++.h>
#define endl "\n"
using namespace std;
void CPP_INIT() {
ios::sync_with_stdio(false);
cin.tie(NULL);
cout.tie(NULL);
}
int main(void) {
CPP_INIT();
int input;
int sum = 0;
cin >> input;
if (input < 10) {
cout << input;
return 0;
}
for (int i = 1; i <= input; i *= 10) {
sum += input - i + 1;
}
cout << sum;
}