Algorithm/백준 137

C++ 알고리즘 - 백준 4375 1 (모듈러 연산 원칙 관련)

https://www.acmicpc.net/problem/4375 #include #define endl "\n"using namespace std;void CPP_INIT() { ios::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);}int main(void) { CPP_INIT(); int num; while (true) { cin >> num; if (cin.eof()) return 0; int chk = 1; int jari = 1; while (true) { if (chk % num == 0) { cout   (A mod B) mod B  ==  A mod B chk %= num; 을 해준 후 chk % num을 한번 더 하..

Algorithm/백준 2025.01.19
C++ 알고리즘 - 백준 25501 재귀의 귀재 (참조자 문자열)

https://www.acmicpc.net/problem/25501 #include #define endl "\n"using namespace std;int cnt = 0;void CPP_INIT() { ios::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);}int recursion(string& s, int l, int r) { cnt++; if (l >= r) return 1; else if (s[l] != s[r]) return 0; else return recursion(s, l + 1, r - 1);}int isPalindrome(string& s) { return recursion(s, 0, s.size() - 1);}int main(void..

Algorithm/백준 2025.01.17