본문 바로가기

Programming/BaekJoon

[C++] 백준 1546번 : 평균 https://www.acmicpc.net/problem/1546 #include using namespace std;int main() { int n;cin >> n;int *score = new int[n];for (int i = 0; i > score[i]; int best;best = score[0];for (int i = 0; i < n - 1; i++){if (best < score[i + 1])best = score[i + 1];} float sum = 0;for (int i = 0; i < n; i++) sum = sum + (float)score[i] / best *100;cout 더보기
[C++] 백준 1476번 : 날짜 계산 https://www.acmicpc.net/problem/1476 #include using namespace std;int main() { int E, S, M;cin >> E >> S >> M;int year = 1;int E_s = 1, S_s = 1, M_s = 1; while (1) {if ((E_s == E) && (S_s == S) && (M_s == M)) break;else year++; E_s++;S_s++;M_s++;if (E_s == 16) E_s = 1;if (S_s == 29) S_s = 1;if (M_s == 20) M_s = 1; }cout 더보기
[C++] 백준 1475번 : 방 번호 https://www.acmicpc.net/problem/1475 #include using namespace std;int main() {int n;cin >> n;int cnt=0;int N_div=1; int m = n;while (1) {if (m / 10 > 0) {cnt++;m = m / 10;N_div = N_div * 10;}elsebreak;} int number[9];for (int i = 0; i < 9; i++) number[i] = 0; for (int i = 0; i 더보기
[C++] 백준 1237번 : 정ㅋ벅ㅋ https://www.acmicpc.net/problem/1237 #include using namespace std;int main(){ cout 더보기
[C++] 백준 1193번 : 분수찾기 https://www.acmicpc.net/problem/1193 #include using namespace std;int main() {int n = 1, num;int a, b;cin >> num; while ((1 + n)*n / 2 < num) { n++; }if (n % 2)//짝수{num = num - n * (n - 1) / 2;a = n - num + 1;b = num;}else {num = num - n * (n - 1) / 2;a = num;b = n - num + 1;}cout 더보기