알고리즘 136

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을 한번 더 하..

알고리즘 2025.01.19