This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
#include <vector> | |
#include <algorithm> | |
using namespace std; | |
bool cmp(const int a, const int b){ | |
return a>b; | |
} | |
int main(){ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
#include <map> | |
using namespace std; | |
int main(){ | |
//int 자료형을 key로 int 자료형을 데이터로 저장하는 딕셔너리 자료구조 생성 | |
map<int, int> m; | |
//(4, 5)원소 삽입 | |
m.insert(make_pair(4, 5)); | |
//또는 | |
m[5]=6; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
#include <utility> | |
using namespace std; | |
int main(){ | |
//int, int 자료형을 저장하는 변수 선언 | |
pair<int, int> p; | |
//(4, 5)를 p에 저장 | |
p=make_pair(4, 5); | |
//c++11부터 가능 | |
p={4, 5}; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
#include <set> | |
using namespace std; | |
int main(){ | |
//int 자료형을 저장하는 균형잡힌 이진트리 생성 | |
set<int> s; | |
//원소(5) 삽입 | |
s.insert(5); | |
//6값을 가지는 원소를 찾음 있다면 해당 원소의 주소값, 없다면 s.end()리턴 | |
if(s.find(6)!=s.end()) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
#include <deque> | |
using namespace std; | |
int main(){ | |
//int 자료형을 저장하는 동적배열 생성 | |
deque<int> dq; | |
//배열 맨 앞에 원소(5) 추가 | |
dq.push_front(5); | |
//배열 맨 뒤에 원소(5) 추가 | |
dq.push_back(5); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
#include <queue> | |
using namespace std; | |
int main(){ | |
//int자료형을 저장하는 큐 생성 | |
queue<int> q; | |
//원소(4) 삽입 | |
q.push(4); | |
//맨 위 원소 팝 | |
q.pop(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
#include <stack> | |
using namespace std; | |
int main(){ | |
//int자료형을 저장하는 스택 생성 | |
stack<int> st; | |
//원소(4) 삽입 | |
st.push(4); | |
//맨 위 원소 팝 | |
st.pop(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
#include <vector> | |
using namespace std; | |
int main(){ | |
//int 자료형을 저장하는 동적배열 | |
vector<int> vec1; | |
//double 자료형을 저장하는 동적배열 | |
vector<double> vec2; | |
//사용자가 정의한 Node 구조체를 저장하는 동적배열 | |
vector<Node> vec3; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
#include <cstdio> | |
using namespace std; | |
char Map[8][9]; | |
int main(){ | |
for (int i = 0; i < 8; i++) | |
scanf("%s", Map[i]); | |
int cnt = 0; | |
for (int i = 0; i < 8; i++) | |
for (int j = 0; j < 8; j++){ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
#include <cstdio> | |
#include <string> | |
using namespace std; | |
int main(){ | |
int TestCase; | |
scanf("%d", &TestCase); | |
while(TestCase--){ | |
int n; | |
string str; |