Notice
Recent Posts
Recent Comments
Link
알고리즘 모음(C++)
백준 27866 - 문자와 문자열(C++) 본문
문제 링크입니다. https://www.acmicpc.net/problem/27866
27866번: 문자와 문자열
첫째 줄에 영어 소문자와 대문자로만 이루어진 단어 $S$가 주어진다. 단어의 길이는 최대 $1\,000$이다. 둘째 줄에 정수 $i$가 주어진다. ($1 \le i \le \left|S\right|$)
www.acmicpc.net
N번째 문자를 출력하는 문제입니다.
자세한 것은 코드를 참고해주세요.
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <queue>
#include <vector>
#include <cstring>
#include <cmath>
#define P pair<int, int>
#define F first
#define S second
#define INF 987654321
using namespace std;
string arr;
int N;
int main(){
cin.tie(0);
cout.tie(0);
cin >> arr;
cin >> N;
cout << arr[N-1];
return 0;
}
질문 및 조언은 댓글을 남겨주세요
'백준' 카테고리의 다른 글
백준 2789 - 유학 금지(C++) (0) | 2023.05.10 |
---|---|
백준 11945 - 뜨거운 붕어빵(C++) (0) | 2023.05.10 |
백준 2864 - 5와 6의 차이(C++) (0) | 2023.05.10 |
백준 10102 - 개표(C++) (0) | 2023.05.10 |
백준 10824 - 네 수(C++) (0) | 2023.05.06 |