Algorithm
-
백준 1946번: 신입 사원그리디(Greedy) 2019. 1. 6. 14:15
https://www.acmicpc.net/problem/1946 1. 문제 정렬 후 second 값을 비교 second 값을 업데이트 2. 알고리즘키워드 - 그리디, 구현 3. 코드 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152#include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace std; #define MAX_SIZE 100#define INF 0x7fffffff#define CEN..
-
Codeforces Round #479 (Div. 3)코드포스(CodeForce) 2018. 6. 30. 11:43
1. 문제 (http://codeforces.com/contest/977/problem/A)A. Wrong Subtractiontime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputLittle girl Tanya is learning how to decrease a number by one, but she does it wrong with a number consisting of two or more digits. Tanya subtracts one from a number by the following algorithm:if the last digit of the number ..
-
백준 1012번: 유기농 배추(DFS)깊이우선탐색(DFS) 2018. 6. 23. 15:54
https://www.acmicpc.net/problem/1012 1. 문제차세대 영농인 한나는 강원도 고랭지에서 유기농 배추를 재배하기로 하였다. 농약을 쓰지 않고 배추를 재배하려면 배추를 해충으로부터 보호하는 것이 중요하기 때문에, 한나는 해충 방지에 효과적인 배추흰지렁이를 구입하기로 결심한다. 이 지렁이는 배추근처에 서식하며 해충을 잡아 먹음으로써 배추를 보호한다. 특히, 어떤 배추에 배추흰지렁이가 한 마리라도 살고 있으면 이 지렁이는 인접한 다른 배추로 이동할 수 있어, 그 배추들 역시 해충으로부터 보호받을 수 있다.(한 배추의 상하좌우 네 방향에 다른 배추가 위치한 경우에 서로 인접해있다고 간주한다)한나가 배추를 재배하는 땅은 고르지 못해서 배추를 군데군데 심어놓았다. 배추들이 모여있는 곳에는 ..
-
Codeforces Round #488 by NEAR (Div. 2) - A. Fingerprints구현(Implementation) 2018. 6. 20. 15:53
http://codeforces.com/contest/994/problem/A 1. 문제 A. Fingerprintstime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputYou are locked in a room with a door that has a keypad with 10 keys corresponding to digits from 0 to 9. To escape from the room, you need to enter a correct code. You also have a sequence of digits.Some keys on the keypad have fing..