본문 바로가기

구현4

AtCoder ABC 244 풀이 https://atcoder.jp/contests/abc244/tasks Tasks - AtCoder Beginner Contest 244 AtCoder is a programming contest site for anyone from beginners to experts. We hold weekly programming contests online. atcoder.jp A. 마지막 글자를 출력해줍시다. #include using namespace std; using ll = long long; int main() { ios::sync_with_stdio(0), cin.tie(0); int n; string s; cin >> n >> s; cout n; string s; cin >> s; int x = .. 2022. 9. 25.
AtCoder ABC 262 풀이 https://atcoder.jp/contests/abc262/tasks Tasks - AtCoder Beginner Contest 262 AtCoder is a programming contest site for anyone from beginners to experts. We hold weekly programming contests online. atcoder.jp A. 나머지 분류후 적절히 4k+2꼴로 만들어주면 됩니다. #include using namespace std; int main() { ios::sync_with_stdio(0), cin.tie(0); int n; cin >> n; if (n % 4 == 0) { cout > u >> v; g[u][v] = 1; g[v][u] = 1; .. 2022. 8. 30.
백준 2873 / C++ https://www.acmicpc.net/problem/2873 2873번: 롤러코스터 첫째 줄에 가장 가장 큰 기쁨을 주는 롤러코스터는 가장 왼쪽 위 칸부터 가장 오른쪽 아래 칸으로 어떻게 움직이면 되는지를 출력한다. 위는 U, 오른쪽은 R, 왼쪽은 L, 아래는 D로 출력한다. 정답 www.acmicpc.net [ 풀이 ] 홀수인 변이 있다면 전부 방문할 수 있음은 자명하다. 모두 짝수인 경우의 문제를 풀자. 규칙을 찾아보자. 전부 방문하는건 불가능하다. 증명은 다음과 같다. 전부 방문하려면 (r-1)(c-1)개의 화살표가 필요하다. 이 값은 홀수이다. 그런데 시작점에서 끝점으로 가는데엔 짝수번의 화살표가 필요하다. 따라서 홀짝성에 위배된다. 그럼 되도록 1개만 제외하고 방문하고 싶다. 이런 문제의 .. 2022. 8. 12.
백준 10277 / C++ https://www.acmicpc.net/problem/10277 10277번: JuQueen The input contains a single test case. It starts with a line containing three integers C, N, and O, where C is the number of cores (1 ≤ C ≤ 4 587 520) to manage, N is the number of frequency steps for each core (1 ≤ N ≤ 10 000) and O is the number www.acmicpc.net [ 풀이 ] 문제조건이 특이하다. 값을 변경시킬때마다 증가하거나 감소시키는데 하나라도 0이나 N이 되면 변경행위를 멈춘다. 예를 들어 2 3 3.. 2022. 8. 5.