Skip to content

Commit 8dce1ad

Browse files
committed
update README.md
1 parent 32f9e73 commit 8dce1ad

File tree

6 files changed

+190
-0
lines changed

6 files changed

+190
-0
lines changed

README.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,12 @@ Personal Solution of Algorithm Probs
1414
#### [6.1차원 배열 사용하기](https://www.acmicpc.net/step/6)
1515
#### [7.문자열 사용하기](https://www.acmicpc.net/step/7)
1616
#### [8.규칙 찾기](https://www.acmicpc.net/step/8)
17+
#### [9.정렬해보기](https://www.acmicpc.net/step/9)
18+
- [2750](https://www.acmicpc.net/problem/2750) : 수 정렬하기 = [풀이](https://github.com/devOTTO/Algorithm-Study/blob/master/baekjoon/2750.cpp)
19+
- [2751](https://www.acmicpc.net/problem/2751) : 수 정렬하기 2 = [풀이](https://github.com/devOTTO/Algorithm-Study/blob/master/baekjoon/2751.cpp)
20+
- [10989](https://www.acmicpc.net/problem/10989) : 수 정렬하기 3 = [풀이](https://github.com/devOTTO/Algorithm-Study/blob/master/baekjoon/10989.cpp)
21+
- [2108](https://www.acmicpc.net/problem/2108) : 통계학 = [풀이](https://github.com/devOTTO/Algorithm-Study/blob/master/baekjoon/2108.cpp)
22+
- [1427](https://www.acmicpc.net/problem/1427) : 소트인사이드 = [풀이](https://github.com/devOTTO/Algorithm-Study/blob/master/baekjoon/1427.cpp)
1723

1824
### 테마별로 풀어보기
1925

baekjoon/10989.cpp

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
//
2+
// Created by 융미 on 2019-04-26.
3+
//10989 수 정렬하기 3
4+
#include <cstdio>
5+
6+
int main() {
7+
int arr[10001]={0,};
8+
9+
int N;
10+
int num;
11+
12+
scanf("%d", &N);
13+
while(N--)
14+
{
15+
scanf("%d", &num);
16+
arr[num]++;
17+
}
18+
19+
for(int i = 1; i<=10000; i++)
20+
{
21+
for(int j= 0; j<arr[i]; j++)
22+
printf("%d\n", i);
23+
}
24+
return 0;
25+
}
26+
27+

baekjoon/1427.cpp

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
//
2+
// Created by 융미 on 2019-04-26.
3+
//1427 소트인사이드
4+
5+
#include <cstdio>
6+
#include <algorithm>
7+
8+
int main(){
9+
int arr[10] = {0, };
10+
int input = 0;
11+
12+
scanf("%d", &input);
13+
14+
int i = 0;
15+
while(input){
16+
arr[i++] = input%10;
17+
input /=10;
18+
}
19+
20+
21+
std::sort(arr,arr+i);
22+
23+
for(int j = i - 1; j>-1; j--)
24+
printf("%d", arr[j]);
25+
26+
return 0;
27+
}
28+

baekjoon/2108.cpp

Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
//
2+
// Created by 융미 on 2019-04-26.
3+
//2108 통계학
4+
#include <iostream>
5+
#include <vector>
6+
#include <algorithm>
7+
#include <cmath>
8+
9+
int main(){
10+
11+
int num = 0;
12+
int arr[8001] = {0,};
13+
int temp = 0;
14+
int sansul = 0;
15+
int mid = 0;
16+
int most = -1;
17+
std::vector<int> bin;
18+
int first = 8001;
19+
int last = -1;
20+
int count = 0;
21+
22+
std::cin >> num;
23+
for(int i = 0; i<num; i++)
24+
{
25+
std::cin >> temp;
26+
++arr[temp+4000];
27+
}
28+
29+
//산술
30+
for(int i = 0; i<8001; i++)
31+
{
32+
if(arr[i] != 0)
33+
{
34+
if(i<first)
35+
first = i;
36+
if(i>last)
37+
last = i;
38+
39+
if(most < arr[i])
40+
{
41+
bin.clear();
42+
most = arr[i];
43+
}
44+
if(most == arr[i])
45+
bin.push_back(i);
46+
47+
for(int j = 0; j<arr[i]; j++)
48+
{
49+
50+
if(++count == (num/2 + 1))
51+
{
52+
mid = i-4000;
53+
}
54+
sansul+=(i-4000);
55+
}
56+
}
57+
}
58+
59+
std::cout << floor((double)sansul/num+0.5) << '\n';
60+
61+
//중앙
62+
std::cout << mid << '\n';
63+
64+
//최빈
65+
most = bin[0];
66+
// 최빈값이 여러개인 경우 두번째로 작은 값 선택
67+
if (bin.size() > 1) {
68+
sort(bin.begin(), bin.end());
69+
most = bin[1];
70+
}
71+
std::cout << most - 4000 << '\n';
72+
73+
//범위
74+
std::cout << last - first;
75+
76+
return 0;
77+
}
78+

baekjoon/2750.cpp

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
//
2+
// Created by 융미 on 2019-04-26.
3+
//2750 수 정렬하기
4+
#include <cstdio>
5+
#include <algorithm>
6+
7+
int main(){
8+
int arr[1000];
9+
int num;
10+
11+
scanf("%d", &num);
12+
int i = 0;
13+
int j = num;
14+
while(j--){
15+
scanf("%d", &arr[i++]);
16+
}
17+
18+
std::sort(arr, arr+num);
19+
i = 0;
20+
while(num--)
21+
{
22+
printf("%d\n", arr[i++]);
23+
}
24+
return 0;
25+
}
26+

baekjoon/2751.cpp

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
//
2+
// Created by 융미 on 2019-04-26.
3+
//2751 수 정렬하기 2
4+
#include <cstdio>
5+
#include <algorithm>
6+
7+
int main(){
8+
int arr[1000000];
9+
int num;
10+
11+
scanf("%d", &num);
12+
int i = 0;
13+
int j = num;
14+
while(j--){
15+
scanf("%d", &arr[i++]);
16+
}
17+
18+
std::sort(arr, arr+num);
19+
i = 0;
20+
while(num--)
21+
{
22+
printf("%d\n", arr[i++]);
23+
}
24+
return 0;
25+
}

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy