USACO5 [ALGORITHM] 10037 - Decorating the Pastures https://www.acmicpc.net/problem/10037 10037번: Decorating the Pastures Farmer John has N (1 2022. 10. 3. [ALGORITHM] 백준 9881 - Ski Course Design https://www.acmicpc.net/problem/9881 9881번: Ski Course Design Farmer John has N hills on his farm (1 N; hills.resize(N); for(int i=0;i>hills[i]; sort(hills.begin(),hills.end()); } int calc(){ int ret=987654321; for(int r=hills[N-1], l=hills[N-1]-17;l>=hills[0];r--, l--){ int sum=0; for(int j=0;hills[j]r;j--){ sum+=(hills[j]-r)*(hills[j]-r); } ret = min(ret, sum); } if(ret == 987654321) return 0;.. 2022. 10. 2. [ALGORITHM] 백준 5901 - Relocation https://www.acmicpc.net/problem/5901 5901번: Relocation Input Details There are 5 towns, with towns 1, 2, and 3 having markets. There are 6 roads. Output Details FJ builds his farm in town 5. His daily schedule takes him through towns 5-1-2-3-2-1-5, for a total distance of 12. www.acmicpc.net 대강 해석 존은 N(1 >K; int a,b,c; for(int i=0;i>a; market.push_back(a); } sort(market.begin(),market.end()); fo.. 2022. 10. 1. [Algorithm] 백준 9874 - Wormholes https://www.acmicpc.net/problem/9874 9874번: Wormholes Farmer John's hobby of conducting high-energy physics experiments on weekends has backfired, causing N wormholes (2 >b; W.push_back({a,b}); } sort(W.begin(),W.end()); } int next_hole(int idx){ int y = W[idx].second; int x = W[idx].first; for(int i=0;i 2022. 9. 30. 이전 1 2 다음