본문 바로가기

Programming/BaekJoon

[C++] 백준 1188번 : 음식 평론가 https://www.acmicpc.net/problem/1188 #includeusing namespace std;int main() {int n, m;cin >> n >> m;int cnt = 0; while (1) {if ((n = n % m) == 0)break; if (m%n == 0){cnt = (m / n - 1)*n + cnt;break;}else {cnt = (m / n)*n + cnt;m = m % n;}} cout 더보기
[C++] 백준 5612번 : 터널의 입구와 출구 https://www.acmicpc.net/problem/5612 #include using namespace std;int main() {int n, m; cin >> n >> m;int a, b;int tmp = m;for (int i = 0; i > a >> b;m = m + a - b;if (m = tmp)tmp = m;}cout 더보기
[C++] 백준 5575번 : 타임 카드 https://www.acmicpc.net/problem/5575 #include using namespace std; int main() {int h1,h2,m1,m2,s1,s2;int h, m, s; for (int i = 0; i > h1 >> m1 >> s1 >> h2 >> m2 >> s2; if ((s2 - s1) >= 0)s = s2 - s1;else {s = s2 - s1 + 60;m2--;}if ((m2 - m1) >= 0)m = m2 - m1;else {m = m2 - m1 + 60;h2--;}h = h2 - h1; cout 더보기
[C++] 백준 2033번 : 반올림 https://www.acmicpc.net/problem/2033 #include using namespace std;int main() {long long n;cin >> n; long long tmp=10;while(n>=tmp){(n%tmp) >= tmp / 2 ? n = ((long long)((int)n / tmp) + 1)*tmp : n = ((long long)(int)n / tmp)*tmp;tmp *= 10;} cout 더보기
[C++] 백준 2909번 : 캔디 구매 https://www.acmicpc.net/problem/2909 #include #include using namespace std;int main() {int n,k;cin >> n >> k;int tmp = pow(10,k);int n1;n1 = n % tmp;n1 >= pow(10, k) / 2 ? n = n+(pow(10, k)-n1) : n = n - n1;cout 더보기
[C++] 백준 10539번 : 수빈이와 수열 https://www.acmicpc.net/problem/10539 #include using namespace std;int main() {int n;cin >> n; int sum = 0 , n1,result;for (int i = 0; i > n1;result = n1 * (i + 1) - sum;cout 더보기
[C++] 백준 5533번 : 유니크 https://www.acmicpc.net/problem/5533 #include #include using namespace std;int main() { int n;cin >> n;int **Player = new int*[n]; int Card[100] = { 0, };int tmp;for (int i = 0; i > Player[i][j];Card[Player[i][j] - 1] = tmp+ Card[Player[i][j] - 1];}} int sum = 0;for (int i = 0; i < n; i++) {for (int j = 0;.. 더보기
[C++] 백준 2783번 : 삼각 김밥 https://www.acmicpc.net/problem/2783 #include using namespace std;int main() {double S_25;int a, b;cin >> a >> b;double min = ((double)a / b);; int n;cin >> n;for (int i = 0; i > a >> b;min = min > ((double)a / b) ? ((double)a / b) : min;} cout 더보기