목록생활/코테 (670)
No Rules Rules
전력난 https://www.acmicpc.net/problem/6497 6497번: 전력난 성진이는 한 도시의 시장인데 거지라서 전력난에 끙끙댄다. 그래서 모든 길마다 원래 켜져 있던 가로등 중 일부를 소등하기로 하였다. 길의 가로등을 켜 두면 하루에 길의 미터 수만큼 돈이 들 www.acmicpc.net // woohyeon.kim // kim519620.tistory.com #include #include #include #include using namespace std; vector arr[200000]; // 다음 집, 거리 bool visit[200000]; priority_queue q; // 거리, 다음 집 int main() { ios::sync_with_stdio(false), cin..
세 막대 https://www.acmicpc.net/problem/14215 14215번: 세 막대 첫째 줄에 a, b, c (1 ≤ a, b, c ≤ 100)가 주어진다. www.acmicpc.net // woohyeon.kim // kim519620.tistory.com #include #include #include #include using namespace std; int main() { ios::sync_with_stdio(false), cin.tie(NULL); register int a, b, c; vector arr; cin >> a >> b >> c, arr.push_back(a), arr.push_back(b), arr.push_back(c); while(true){ sort(arr...
대지 https://www.acmicpc.net/problem/9063 9063번: 대지 첫째 줄에는 점의 개수 N (1 ≤ N ≤ 100,000) 이 주어진다. 이어지는 N 줄에는 각 점의 좌표가 두 개의 정수로 한 줄에 하나씩 주어진다. 각각의 좌표는 -10,000 이상 10,000 이하의 정수이다. www.acmicpc.net // woohyeon.kim // kim519620.tistory.com #include #include using namespace std; int main() { ios::sync_with_stdio(false), cin.tie(NULL); register int N; pair min(10000, 10000), max(-10000, -10000); cin >> N; for..
나만 안되는 연애 https://www.acmicpc.net/problem/14621 14621번: 나만 안되는 연애 입력의 첫째 줄에 학교의 수 N와 학교를 연결하는 도로의 개수 M이 주어진다. (2 ≤ N ≤ 1,000) (1 ≤ M ≤ 10,000) 둘째 줄에 각 학교가 남초 대학교라면 M, 여초 대학교라면 W이 주어진다. 다음 M개의 www.acmicpc.net // woohyeon.kim // kim519620.tistory.com #include #include #include #include using namespace std; char school_type[1001]{0}; // 학교 종류 bool visit[1001]{false}; vector arr[1001]; // 다음 학교 번호, ..
삼각형과 세 변 https://www.acmicpc.net/problem/5073 5073번: 삼각형과 세 변 각 입력에 맞는 결과 (Equilateral, Isosceles, Scalene, Invalid) 를 출력하시오. www.acmicpc.net // woohyeon.kim // kim519620.tistory.com #include #include using namespace std; int main() { ios::sync_with_stdio(false), cin.tie(NULL); register int a, b, c, d, e, f; priority_queue q; while(1){ cin >> a >> b >> c; if(a == 0 && b == 0 && c == 0) break; q...
삼각형 외우기 https://www.acmicpc.net/problem/10101 10101번: 삼각형 외우기 문제의 설명에 따라 Equilateral, Isosceles, Scalene, Error 중 하나를 출력한다. www.acmicpc.net // woohyeon.kim // kim519620.tistory.com #include #include using namespace std; int main() { ios::sync_with_stdio(false), cin.tie(NULL); register int a, b, c, ans = 0; unordered_map arr; cin >> a >> b >> c, ++arr[a], ++arr[b], ++arr[c]; for(auto& v : arr) an..
Four Squares https://www.acmicpc.net/problem/17626 17626번: Four Squares 라그랑주는 1770년에 모든 자연수는 넷 혹은 그 이하의 제곱수의 합으로 표현할 수 있다고 증명하였다. 어떤 자연수는 복수의 방법으로 표현된다. 예를 들면, 26은 52과 12의 합이다; 또한 42 + 32 + 1 www.acmicpc.net // woohyeon.kim // kim519620.tistory.com #include #include using namespace std; int dp[50001]{0}; int main() { ios::sync_with_stdio(false), cin.tie(NULL); register int n; cin >> n; dp[1] = 1..
수학은 체육과목 입니다 https://www.acmicpc.net/problem/15894 15894번: 수학은 체육과목 입니다 성원이는 수학을 정말 못 하는 고등학생이다. 수학을 못하는 대신 근성과 팔 힘이 뛰어난 성원이는 수학 시험에서 수학 지식을 사용하지 않고 근성과 체력을 사용해 문제를 푼다. 지난 시험에서 www.acmicpc.net // woohyeon.kim // kim519620.tistory.com #include using namespace std; int main() { ios::sync_with_stdio(false), cin.tie(NULL); register long long n; cin >> n, cout
수학은 비대면강의입니다 https://www.acmicpc.net/problem/19532 19532번: 수학은 비대면강의입니다 정수 $a$, $b$, $c$, $d$, $e$, $f$가 공백으로 구분되어 차례대로 주어진다. ($-999 \leq a,b,c,d,e,f \leq 999$) 문제에서 언급한 방정식을 만족하는 $\left(x,y\right)$가 유일하게 존재하고, 이 때 $x$와 $y$가 각각 $- www.acmicpc.net // woohyeon.kim // kim519620.tistory.com #include using namespace std; int main() { ios::sync_with_stdio(false), cin.tie(NULL); register int a, b, c, d..
Moocast https://www.acmicpc.net/problem/14167 14167번: Moocast Farmer John's N cows (1≤N≤1000) want to organize an emergency "moo-cast" system for broadcasting important messages among themselves. Instead of mooing at each-other over long distances, the cows decide to equip themselves with walkie-talkies, one for www.acmicpc.net // woohyeon.kim // kim519620.tistory.com #include #include #include ..