분류 전체보기 226

백준 23832: 서로소 그래프

https://www.acmicpc.net/problem/23832 23832번: 서로소 그래프 우석이는 심심할 때마다 그래프를 그린다. 우석이는 매달 새로운 그래프를 그리는데, 이번 달에는 서로소 그래프를 그린다. 서로소 그래프는 $1$부터 $N$까지의 번호를 가진 $N$ 개의 정점으로 이 www.acmicpc.net 코드 #include using namespace std; #define ull unsigned long long int ull Power(__int128 x, __int128 y, __int128 mod) { x %= mod; ull ret = 1; while(y > 0) { if(y%2 == 1) ret = (ret*x)%mod; x = (x*x)%mod; y /= 2; } retur..

백준 1461: 도서관 [C/C++]

https://www.acmicpc.net/problem/1461 1461번: 도서관 세준이는 도서관에서 일한다. 도서관의 개방시간이 끝나서 세준이는 사람들이 마구 놓은 책을 다시 가져다 놓아야 한다. 세준이는 현재 0에 있고, 사람들이 마구 놓은 책도 전부 0에 있다. 각 책 www.acmicpc.net 코드 #include #include #include using namespace std; #define fastio() ios::sync_with_stdio(0),cin.tie(0),cout.tie(0); int N, M, l, r, ans; vector arr; int main() { fastio(); cin >> N >> M; arr = vector(N); for (int i = 0; i > ar..

백준(C, C++) 2022.06.28

백준 12904: A와 B [C/C++]

https://www.acmicpc.net/problem/12904 12904번: A와 B 수빈이는 A와 B로만 이루어진 영어 단어가 존재한다는 사실에 놀랐다. 대표적인 예로 AB (Abdominal의 약자), BAA (양의 울음 소리), AA (용암의 종류), ABBA (스웨덴 팝 그룹)이 있다. 이런 사실에 놀란 수 www.acmicpc.net 코드 #include #include #include #define fastio() ios::sync_with_stdio(0),cin.tie(0),cout.tie(0); using namespace std; string s, t; int ss, tt; int main() { fastio(); cin >> s >> t; ss = s.size() - 1; tt =..