| 일 | 월 | 화 | 수 | 목 | 금 | 토 |
|---|---|---|---|---|---|---|
| 1 | 2 | 3 | 4 | 5 | 6 | |
| 7 | 8 | 9 | 10 | 11 | 12 | 13 |
| 14 | 15 | 16 | 17 | 18 | 19 | 20 |
| 21 | 22 | 23 | 24 | 25 | 26 | 27 |
| 28 | 29 | 30 | 31 |
Tags
- lazy propagation
- 너비 우선 탐색
- 회고록
- 백트래킹
- 우선 순위 큐
- 2023
- 분할 정복
- dropout
- c++
- tensorflow
- pytorch
- 알고리즘
- NEXT
- BFS
- 다익스트라
- 조합론
- Overfitting
- 자바스크립트
- 가끔은_말로
- back propagation
- object detection
- 세그먼트 트리
- 미래는_현재와_과거로
- 문자열
- DP
- 크루스칼
- dfs
- 이분 탐색
- 플로이드 와샬
- 가끔은 말로
Archives
- Today
- Total
Doby's Lab
백준 2857번: FBI (C++) 본문
https://www.acmicpc.net/problem/2857
2857번: FBI
5개 줄에 요원의 첩보원명이 주어진다. 첩보원명은 알파벳 대문자, 숫자 0~9, 대시 (-)로만 이루어져 있으며, 최대 10글자이다.
www.acmicpc.net
Solved By: string
substr(pos, cnt)
#include <iostream>
#include <string>
#include <vector>
using namespace std;
int main(){
bool flag = true;
vector<int> res;
for(int i = 1; i <= 5; i++){
string s;
cin >> s;
for(int j = 0; j < s.length() - 2; j++){
string tmp = s.substr(j, 3);
if(tmp == "FBI"){
flag = false;
res.push_back(i);
break;
}
}
}
if(flag) cout << "HE GOT AWAY!";
else{
for(auto i : res) cout << i << ' ';
}
return 0;
}
'PS > BOJ' 카테고리의 다른 글
| 백준 4149번: 큰 수 소인수분해 (C++) (0) | 2022.08.01 |
|---|---|
| 백준 16563번: 어려운 소인수분해 (C++) (1) | 2022.08.01 |
| 백준 4779번: 칸토어 집합 (C++) (0) | 2022.07.30 |
| 백준 17362번: 수학은 체육과목 입니다 2 (Python) (0) | 2022.07.26 |
| 백준 13237번: Binary tree (C++) (0) | 2022.07.24 |