Notice
Recent Posts
Recent Comments
Link
| 일 | 월 | 화 | 수 | 목 | 금 | 토 |
|---|---|---|---|---|---|---|
| 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
- 개발
- Computer science
- vector
- 북리뷰
- 너비우선탐색
- 백준
- 정석
- 컴퓨터공학과
- 자료구조
- 오에스
- Stack
- bfs
- OS
- 문제풀이
- 그래프
- 컴공과
- 알고리즘
- 오퍼레이팅시스템
- 구현
- c++
- 컴공
- 코딩
- DP
- Operating System
- 코테
- coding
- 스택
- cs
- 브루트포스
- 정석학술정보관
Archives
- Today
- Total
Little Jay
[C++] 백준 14656번 조교는 새디스트야!! 본문
#include <iostream>
#include <vector>
using namespace std;
int main() {
int input, a;
cin >> input;
int count = 0;
vector<int> compVec;
vector<int> numbers;
for (int i = 0; i < input; i++) {
cin >> a;
numbers.push_back(i + 1);
compVec.push_back(a);
if (numbers[i] != compVec[i]) {
count++;
}
}
compVec.clear();
numbers.clear();
cout << count << "\n";
return 0;
}
'알고리즘 > BOJ' 카테고리의 다른 글
| [C++] 백준 1284번 집 주소 (0) | 2021.03.06 |
|---|---|
| [C++] 백준 3052번 나머지 (0) | 2021.03.06 |
| [C++] 백준 2566번 최댓값 (0) | 2021.03.06 |
| [C++] 백준 2511번 카드놀이 (0) | 2021.03.06 |
| [C++] 백준 2587번 대표값2 (0) | 2021.03.05 |
Comments