본문 바로가기

PKU 2291. Rotten Ropes 썩은 밧줄 Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 4023 Accepted: 2620 설명 어떤 무거운 물체를 들어올리기 위해서 같은 길이인 n 개의 밧줄이 있다고 생각해봅시다. 이 때 각 밧줄들과 연결시켜 물체를 들어올리기 때문에 각 밧줄이 버틸수 있는 무게인 t 를 넘는 물건을 들어올리려고 하면 밧줄은 끊어집니다. 그러나 우리는 무거운 물체를 여러 개의 밧줄로 평행하게 묶어서 모든 밧줄을 끌어올리는 방법을 쓰면 무거운 물체도 들어올릴 수 있습니다. w 의 무게를 가진 무거운 물건을 들어올리기 위해 k 개의 밧줄을 사용한다면, 각 밧줄에 w/k 만큼의 무게가 주어진다고 가정합니다. 하지만 밧줄이 버틸수 있는 무게인 t 를 놓고 볼 때, .. 더보기
PKU 2291. Rotten Ropes Rotten Ropes Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 4023 Accepted: 2620 Description Suppose we have n ropes of equal length and we want to use them to lift some heavy object. A tear-off weight t is associated to each rope, that is, if we try to lift an object, heavier than t with that rope, it will tear off. But we can fasten a number of ropes to the heavy object (in parallel.. 더보기
PKU 2181. Jumping Cows -_- AC get #include using namespace std; int main() { int n, i, j, cnt = 1, sum = 0, total = 0, temp = 0; int buf[150000]; cin >> n ; for (i = 0; i > buf[i]; } for(j = 1; j buf[j]) { temp = buf[j - 1]; cnt++; sum += temp; } } else { if(buf[j] > buf[j - 1]) { temp = buf[j - 1]; cnt++; sum -= temp; } } } cout 더보기