PS/백준 알고리즘[BOJ]2023. 10. 26. 16:39[백준 1629번] 곱셈 (C++)
/************************************************* 짝수번: A x A x A x A = (A x A) x (A x A) 홀수번: A x A x A x A x A = (A x A) x (A x A) x A *************************************************/ #include using namespace std; long long int dc(int a, int b, int c) { if (b == 1) return a % c;//base condition: A의 1승 if (b % 2) return dc(a, b / 2, c) * dc(a, b / 2, c) % c * a % c; else return dc(a, b / 2, c..
PS/백준 알고리즘[BOJ]2023. 10. 26. 11:20[백준 14600번] 샤워실 바닥 갈기 (Small) (C++)
#include using namespace std; int num; int map[4][4]; bool check(int x1, int y1, int x2, int y2) { for (int i = x1; i > m >> n; map[m-1][n-1] = -1; int siz = (1 = 0; i--, cout