시험 기간이 완전히 끝나게 되었다. 깁브다
https://www.acmicpc.net/problem/9659
9659번: 돌 게임 5
첫째 줄에 N이 주어진다. (1 ≤ N ≤ 1,000,000,000,000)
www.acmicpc.net

풀이
돌을 가져갈 수 있는 방법은 1, 3 두 가지이다.
돌을 홀수 갯수로밖에 가져갈 수 없으므로 놓여있는 돌의 갯수가 홀수개이면 상근이가 짝수개이면 창영이가 게임을 이기게 된다.
시간 복잡도 : O(1)
아쉬운 점 : 더 어려운 문제도 많이 풀어야겠다
전체적인 감상 : 0203peter sprague-grundy theorem 공부하다 갑자기 프로돌게이머로 전향...
/* basic setup {{{ */ #include<bits/stdc++.h> #define ff first #define ss second #define pb push_back #define sz(x) ((int)x.size()) #define all(x) x.begin(),x.end() #define compress(x) sort(all(x)), x.erase(unique(all(x)), x.end()) #define fast_io ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0) using namespace std; typedef long long ll; typedef pair<int,int> pii; typedef pair<ll,ll> pll; typedef const int ci; const int MOD = 1e9+7; const int INF = 0x3f3f3f3f; const ll LINF = 0x3f3f3f3f3f3f3f3f; /*}}}*/ ll n; int main(){ fast_io; cin>>n; if(n%2) cout<<"SK"; else cout<<"CY"; cout<<'\n'; }
'백준 문제 해설' 카테고리의 다른 글
백준 8545 Zadanie próbne (0) | 2022.10.26 |
---|---|
백준 15592 Blocked Billboard II (0) | 2022.10.25 |
백준 15458 Barn Painting (0) | 2022.10.24 |
백준 15457 A Pie for a Pie (0) | 2022.10.23 |
백준 3733 Shares (0) | 2022.10.22 |
백준 24736 Football Scoring (0) | 2022.10.22 |
백준 25311 UCPC에서 가장 쉬운 문제번호는? (0) | 2022.10.22 |
백준 25372 성택이의 은밀한 비밀번호 (0) | 2022.10.22 |