www.acmicpc.net/problem/11723 11723번: 집합 첫째 줄에 수행해야 하는 연산의 수 M (1 ≤ M ≤ 3,000,000)이 주어진다. 둘째 줄부터 M개의 줄에 수행해야 하는 연산이 한 줄에 하나씩 주어진다. www.acmicpc.net #include #include using namespace std; int main() {cin.tie(NULL); ios::sync_with_stdio(false); int n; cin >> n; string input; int tmp; int bit = 0; for (int i = 0; i > input; if (input[1] == 'd')//add { ci..
www.acmicpc.net/problem/2217 2217번: 로프 N(1 ≤ N ≤ 100,000)개의 로프가 있다. 이 로프를 이용하여 이런 저런 물체를 들어올릴 수 있다. 각각의 로프는 그 굵기나 길이가 다르기 때문에 들 수 있는 물체의 중량이 서로 다를 수도 있다. 하 www.acmicpc.net #include #include #include using namespace std; int main() { int ropecnt; cin >> ropecnt; vectorarr(ropecnt+1,0); int tmp; for (int i = 1; i >arr[i]; } sort(arr.begin(), arr.end()); int maxx = -1; for (int i =1;i
www.acmicpc.net/problem/11404 11404번: 플로이드 첫째 줄에 도시의 개수 n이 주어지고 둘째 줄에는 버스의 개수 m이 주어진다. 그리고 셋째 줄부터 m+2줄까지 다음과 같은 버스의 정보가 주어진다. 먼저 처음에는 그 버스의 출발 도시의 번호가 www.acmicpc.net #include #include #include using namespace std; #define INF 10000001 vector arr(101, vector (101, INF)); int main() { int n, m; cin >> n >> m; int a, b, c; for (int i = 1; i > a >> b >> c; if(arr[a][b]>c) arr[a][b] = c; ..
www.acmicpc.net/problem/18353 18353번: 병사 배치하기 첫째 줄에 N이 주어진다. (1 ≤ N ≤ 2,000) 둘째 줄에 각 병사의 전투력이 공백을 기준으로 구분되어 차례대로 주어진다. 각 병사의 전투력은 10,000,000보다 작거나 같은 자연수이다. www.acmicpc.net #include #include using namespace std; int power; int arr[2][2001]; int main() { cin.tie(NULL); int n; cin >> n; for (int i = 0; i > arr[0][i]; arr[1][i] = 1; } int maxx=-99; for (int i = 0; i < n; i++) { int..
www.acmicpc.net/problem/1764 #include #include #include using namespace std; int main(void) { cin.tie(NULL); int n, m; cin >> n >> m; vector arr; vector brr; string tmp; for (int i = 0; i > tmp; arr.push_back(tmp); tmp.clear(); } sort(arr.begin(), arr.end()); //정렬 for (int j = 0; j > tmp; if (binary_search(arr.begin(), arr.end(), tmp)) //이진탐색으로 입력받은 두번째값을 체크 { b..
www.acmicpc.net/problem/2458 2458번: 키 순서 1번부터 N번까지 번호가 붙여져 있는 학생들에 대하여 두 학생끼리 키를 비교한 결과의 일부가 주어져 있다. 단, N명의 학생들의 키는 모두 다르다고 가정한다. 예를 들어, 6명의 학생들에 대하여 www.acmicpc.net #include #include using namespace std; int main() { cin.tie(NULL); int n, m;//n=학생수 m=비교수 cin >> n >> m; vector arr(501, vector(501,0)); //501열 빈 벡터 2차원 배열 선언+초기화 int x, y; for (int j = 1; j > x >> y; arr[x][y] = 1;//가는길이 있음을 표시 //a..
www.acmicpc.net/problem/10026 10026번: 적록색약 적록색약은 빨간색과 초록색의 차이를 거의 느끼지 못한다. 따라서, 적록색약인 사람이 보는 그림은 아닌 사람이 보는 그림과는 좀 다를 수 있다. 크기가 N×N인 그리드의 각 칸에 R(빨강), G(초록) www.acmicpc.net #include using namespace std; int dx[] = { 0,1,0,-1 }; int dy[] = { -1,0,1,0 }; char map[101][101]; bool copymap[101][101] = { false }; int normal=0;//정상 int notnormal=0;//색맹 int n;//정사각형 int temp = 0; void start(int x, int y, ..
www.acmicpc.net/problem/11722 11722번: 가장 긴 감소하는 부분 수열 수열 A가 주어졌을 때, 가장 긴 감소하는 부분 수열을 구하는 프로그램을 작성하시오. 예를 들어, 수열 A = {10, 30, 10, 20, 20, 10} 인 경우에 가장 긴 감소하는 부분 수열은 A = {10, 30, 10, 20, 20, 10} www.acmicpc.net #include #include using namespace std; int frontnum; int main() { int n; cin >> n; vector arr; vector brr(1001); int max = -999; int temp; for (int i = 0; i > temp; arr.pus..
www.acmicpc.net/problem/11399 11399번: ATM 첫째 줄에 사람의 수 N(1 ≤ N ≤ 1,000)이 주어진다. 둘째 줄에는 각 사람이 돈을 인출하는데 걸리는 시간 Pi가 주어진다. (1 ≤ Pi ≤ 1,000) www.acmicpc.net #include #include #include using namespace std; int temp; int result = 0; void ftemp(vector input) { temp = 0; for (int i = 0; i > num; in..
www.acmicpc.net/problem/14697 14697번: 방 배정하기 정보 초등학교 6학년 여학생들은 단체로 2박 3일 수학여행을 가기로 했다. 학생들이 묵을 숙소에는 방의 정원(방 안에 있는 침대 수)을 기준으로 세 종류의 방이 있으며, 같은 종류의 방들이 여러 www.acmicpc.net #include using namespace std; bool fastbreak = false; int main() { int a, b, c, n; cin >> a >> b >> c >> n; for (int i = 0; i * c