본문 바로가기

백준138

[10828] 스택 #include #include #include using namespace std;int main(){stack st;string str;int testcase;cin >> testcase;for (int i = 0; i > str;if (str == "push"){int num;cin >> num;st.push(num);}else if (str == "pop"){if (!st.empty()){cout 2018. 7. 21.
[4948] 베르트랑 공준 #include using namespace std;int main(){bool arr[246913] = { 0 };int i, j;arr[0] = arr[1] = true;for (i = 2; i num;if (num == 0)break;for (i = num+1; i 2018. 7. 21.
[1929] 소수 구하기 #include #include using namespace std;int main(){bool arr[1000001] = { 0 };vector suso;int num1, num2;int i, j;scanf("%d %d", &num1, &num2);arr[0] = arr[1] = true;for (i = 2; i 2018. 7. 17.
[2581] 소수 #include #include using namespace std;int main(){vector suso;int num1, num2, sum = 0;int i, j;cin >> num1;cin >> num2;for (i = num1; i 1){for (j = 1; j 2018. 7. 17.
[1978] 소수 찾기 #include #include using namespace std;int main(){vector v;int n, cnt = 0;cin >> n;for (int i = 0; i > num;v.push_back(num);}for (int i = 0; i 1){for (int j = 1; j 2018. 7. 17.
[1181] 단어 정렬 #include #include #include #include using namespace std;bool cmp(const string &a, const string &b){if (a.size() == b.size())return a n;for (int i = 0; i > str;v.push_back(str);}vector::iterator iter;sort(v.begin(), v.end(), cmp);v.erase(unique(v.begin(), v.end()), v.end());for (iter = v.begin(); iter != v.end(); iter++)cout 2018. 7. 14.
[1427] 소트인사이드 #include #include #include using namespace std;bool cmp(char &a, char &b){return a > b;} int main(){char c[10];cin >> c;sort(c, c+ strlen(c), cmp);cout 2018. 7. 14.
[2108] 통계학 #include #include #include #include using namespace std;bool comp(const pair &p1, const pair &p2){if (p1.second == p2.second)return p1.first p2.second;}int main(){int num, sum=0;double avg;cin >> num;vector v(num);for (int i = 0; i > v[i];for (int i = 0; i 2018. 7. 14.
[2750] 수 정렬하기1, 2 #include #include #include using namespace std;int main(){int num;cin >> num;vector v(num);for (int i = 0; i > v[i];}sort(v.begin(), v.end());vector::iterator itor; for (itor = v.begin(); itor != v.end(); itor++) cout 2018. 7. 14.
[2775] 부녀회장이 될테야 #include using namespace std;int sol(int f, int h);int person[15][15] = { 0, };int main(){int testcase, k, n;cin >> testcase;for (int i = 0; i k;cin >> n;cout 2018. 7. 14.
[1193] 분수찾기 #include using namespace std;int main(){int num , level =1, sum = 1;cin >> num;while (sum 2018. 7. 14.
[2292] 벌집 #include using namespace std;int main(void){long n, range=1;int cnt = 1;cin >> n;while (1){if (range >= n)break;range += (cnt++) * 6;}cout 2018. 7. 14.
[2941] 크로아티아 알파벳 #include #include using namespace std;int chk(string s);int main(void){string str;cin >> str;cout 2018. 7. 14.
[5622] 다이얼 #include #include using namespace std;int chk(char c);int main(void){string str;int time = 0;cin >> str;for (int i = 0; i 2018. 7. 14.
[2908] 상수 #include#includeusing namespace std;int max(int a, int b);int main(void){int a, b;cin >> a;cin >> b;int ra = 0, rb = 0;for (int i = 0; i 2018. 7. 14.
[1316] 그룹 단어 체커 #include #include using namespace std;bool sol(string check);int main(){int num;int cnt = 0;cin >> num;for (int i = 0; i > str;if (sol(str)){cnt++;}}cout 2018. 7. 14.
[1157] 단어 공부 #include #include #include using namespace std;int main(){map m;string str;cin >> str;map::iterator iter;for (int i = 0; i = 'a'){str[i] -= 32;}//기존에 존재 하는 값인지 검사.iter = m.find(str[i]);if (iter != m.end()) //존재할때m[iter->first] += 1;else //존재하지 않을때m[str[i]] = 1;}//횟수가 가장 많은 값을 가리키는 반복자를 찾습니다map::iterator max = m.begin();iter = m.begin()++;for (; iter != m.end(); iter++) {if (max->second second) m.. 2018. 7. 14.
[10809] 알파벳 찾기 #include #include using namespace std;int main(){char s[101];cin >> s;for (char c = 'a'; c 2018. 7. 14.
[11654] 아스키 코드 #include int main(){char abc;scanf("%s", &abc);printf("%d\n", abc); return 0;} 2018. 7. 14.
[2448] 별찍기 - 11 #include #include using namespace std;string arr[3072][6144];void star(int n, int x, int y);int main(){ int i, j; int num; cin >> num; for (i = 0; i 2018. 7. 14.