study

Moo Volume

1차전직 2012. 8. 7. 17:41

알고리즘 문제 풀기 시작!!


문제: http://poj.org/problem?id=2231

번역: http://ckdsswprogramming.tistory.com/45


Hint

INPUT DETAILS: 

There are five cows at locations 1, 5, 3, 2, and 4. 

OUTPUT DETAILS: 

Cow at 1 contributes 1+2+3+4=10, cow at 5 contributes 4+3+2+1=10, cow at 3 contributes 2+1+1+2=6, cow at 2 contributes 1+1+2+3=7, and cow at 4 contributes 3+2+1+1=7. The total volume is (10+10+6+7+7) = 40.




cow

 cow

cow

cow

cow

1번째 cow: 1+2+3+4

2번째 cow: 1+1+2+3

3번째 cow: 2+1+1+2

4번째 cow: 3+2+1+1

5번째 cow: 4+3+2+1


전부 더하면 10+7+6+7+10 = 40







'study' 카테고리의 다른 글

Epoch Time  (0) 2012.08.08
알고리즘 사이트  (0) 2012.07.23
netstat, nbtstat, trace, ping  (0) 2010.11.02