1748번
1748번 - 수 이어쓰기 1 그냥 재귀함수를 통해서 답을 구했다. go 함수는 1~9 까지는 각 한 자리씩 해서 더하고,10~99 까지는 각 두자리씩 해서 더하고,100~999까지는 각 세자리씩 해서 더하고.. 이런식으로 문제를 해결했다. 1234567891011121314151617181920212223242526272829#include using namespace std;int ans = 0;void go(int a,int b,int c,int n){ if (n = a) { ans += c*(a - b); a *= 10; b *= 10; go(a, b, c + 1, n); }}int main(){ int n; scanf("%d", &n); go(10,1,1,n); printf("%d\n", ans..
더보기