이 튜토리얼에서는 주어진 조건을 만족하는 가능한 N 자리 숫자의 개수를 찾는 프로그램에 대해 논의할 것입니다.
이를 위해 정수가 제공됩니다. 우리의 임무는 N자리 숫자 중 어느 숫자가 뒤에 오는지 확인하는 것입니다.
숫자 + 역(숫자) =10N -1
예시
#include <bits/stdc++.h>
using namespace std;
//returning the count of numbers
string count_num(int N){
if (N % 2 == 1)
return 0;
string result = "9";
for (int i = 1; i <= N / 2 - 1; i++)
result += "0";
return result;
}
int main(){
int N = 4;
cout << count_num(N);
return 0;
} 출력
90