Notice
Recent Posts
Recent Comments
Link
Little Jay
[C++] 백준 1453번 - 피시방 알바 본문
동적 배열로 풀면 안되는 문제인 것 같다.
그냥 배열로 풀어야 정답으로 서버가 인정하는 것 같다.
#include <iostream>
using namespace std;
int main() {
int n;
cin >> n;
int arr[101] = { 0, };
int x;
int denied = 0;
for (int i = 0; i < n; i++) {
cin >> x;
if (arr[x] == 1)
denied++;
else
arr[x] = 1;
}
cout << denied << "\n";
return 0;
}'알고리즘 > BOJ' 카테고리의 다른 글
| [C++] 백준 13777번 - Hunt The Rabbit (0) | 2021.08.08 |
|---|---|
| [C++] 백준 1654번 - 랜선 자르기(retry needed) (0) | 2021.08.08 |
| [C++] 백준 11719번 - 그래도 출력하기 2 (0) | 2021.08.07 |
| [C++] 백준 15596번 정수 N개의 합 (0) | 2021.08.07 |
| [C++] 백준 11051번 이항 계수 2 (0) | 2021.08.05 |
Comments