백준 27866 c++

magicdrill·2024년 4월 18일

백준 문제풀이

목록 보기
327/673

백준 27866 c++

#include <iostream>
#include <cstring>

using namespace std;
int main(void)
{
	/*
	char str[1001];
	int i;

	cin >> str;
	cin >> i;
	if (i >= 1 && i <= strlen(str))
	{
		cout << str[i - 1] << endl;
	}
	else
	{
		;
	}

	return 0;
	*/
	char temp[1000];
	char* str = nullptr;
	int i;

	cin >> temp;
	str = new char[strlen(temp) + 1];
	strcpy_s(str, strlen(temp) + 1, temp);
	cin >> i;
	cout << str[i - 1] << endl;
	return 0;
	delete[] str;
}

0개의 댓글