코딩도장

코딩도장

변경이력

돌아가기
6 1358개 문자 추가 95개 문자 삭제

2016年06月28日 05:35

Flair Sizz

이 문제에 관한 흥미로운 페이퍼가 있습니다 <a href = "http://page.mi.fu-berlin.de/rote/Papers/pdf/Crossing+the+bridge+at+night.pdf"> 링크 </a>. 저는 여기에 서술한 알고리즘을 기반으로 코드를 짰어요. C++입니다. <a href = "https://github.com/iljimae0418/SLPC-problems/blob/master/safepassage.cpp"> 코드 </a>. ```{.cpp} // By Minsuk Kim (Luke) // Code that solves 2015 Stanford Local Programming Contest Problem G // Problem link: https://open.kattis.com/contests/onyyqy/problems/safepassage // Variation of the Bridge and Torch problem. // Refer to this link for a theoretical treatment of this problem: // http://page.mi.fu-berlin.de/rote/Papers/pdf/Crossing+the+bridge+at+night.pdf // Maximum input size is only 15 so no need to worry about TLE. #include <iostream> #include <cstdlib> #include <vector> #include <algorithm> #include <climits> using namespace std; vector<int> storeInfo; vector<int> storeVal; int ans = INT_MAX; void calc(){ int N = storeInfo.size(); for (int i = 0; i <= N/2 - 1; i++){ int val = 0; val += (N-2-i)*storeInfo[0] + (2*i+1)*storeInfo[1]; for (int j = 3; j <= N; j++){ val += storeInfo[j-1]; } for (int j = 1; j <= i; j++){ val -= storeInfo[N+1-2*j-1]; } storeVal.push_back(val); } return; } void findMin(){ for (vector<int>::size_type i = 0; i < storeVal.size(); i++){ ans = min(ans,storeVal[i]); } } int main(){ int n; cin >> n; for (int i = 0; i < n; i++){ int num; cin >> num; storeInfo.push_back(num); } sort(storeInfo.begin(),storeInfo.end()); calc(); findMin(); cout << ans << endl; return 0; } ``` 이 코드는 일단 kattis에 있는 체점 데이터는 모두 통과합니다.
이 문제에 관한 흥미로운 페이퍼가 있습니다 <a href = "http://page.mi.fu-berlin.de/rote/Papers/pdf/Crossing+the+bridge+at+night.pdf"> 링크 </a>. 저는 여기에 서술한 알고리즘을 기반으로 코드를 짰어요. C++입니다. <a href = "https://github.com/iljimae0418/SLPC-problems/blob/master/safepassage.cpp"> 코드 </a>. ```{.cpp} // By Minsuk Kim (Luke) // Code that solves 2015 Stanford Local Programming Contest Problem G // Problem link: https://open.kattis.com/contests/onyyqy/problems/safepassage // Variation of the Bridge and Torch problem. // Refer to this link for a theoretical treatment of this problem: // http://page.mi.fu-berlin.de/rote/Papers/pdf/Crossing+the+bridge+at+night.pdf // Maximum input size is only 15 so no need to worry about TLE. #include <iostream> #include <cstdlib> #include <vector> #include <algorithm> #include <climits> using namespace std; vector<int> storeInfo; vector<int> storeVal; int ans = INT_MAX; void calc(){ int N = storeInfo.size(); for (int i = 0; i <= N/2 - 1; i++){ int val = 0; val += (N-2-i)*storeInfo[0] + (2*i+1)*storeInfo[1]; for (int j = 3; j <= N; j++){ val += storeInfo[j-1]; } for (int j = 1; j <= i; j++){ val -= storeInfo[N+1-2*j-1]; } storeVal.push_back(val); } return; } void findMin(){ for (vector<int>::size_type i = 0; i < storeVal.size(); i++){ ans = min(ans,storeVal[i]); } } int main(){ int n; cin >> n; for (int i = 0; i < n; i++){ int num; cin >> num; storeInfo.push_back(num); } sort(storeInfo.begin(),storeInfo.end()); calc(); findMin(); cout << ans << endl; return 0; } ``` 이 코드는 일단 kattis에 있는 체점 데이터는 모두 통과합니다.
이 문제에 관한 흥미로운 페이퍼가 있습니다 <a href = "http://page.mi.fu-berlin.de/rote/Papers/pdf/Crossing+the+bridge+at+night.pdf"> 링크 </a>. 저는 여기에 서술한 알고리즘을 기반으로 코드를 짰어요. C++입니다. <a href = "https://github.com/iljimae0418/SLPC-problems/blob/master/safepassage.cpp"> 코드 </a>. ```{.cpp} // By Minsuk Kim (Luke) // Code that solves 2015 Stanford Local Programming Contest Problem G // Problem link: https://open.kattis.com/contests/onyyqy/problems/safepassage // Variation of the Bridge and Torch problem. // Refer to this link for a theoretical treatment of this problem: // http://page.mi.fu-berlin.de/rote/Papers/pdf/Crossing+the+bridge+at+night.pdf // Maximum input size is only 15 so no need to worry about TLE. #include <iostream> #include <cstdlib> #include <vector> #include <algorithm> #include <climits> using namespace std; vector<int> storeInfo; vector<int> storeVal; int ans = INT_MAX; void calc(){ int N = storeInfo.size(); for (int i = 0; i <= N/2 - 1; i++){ int val = 0; val += (N-2-i)*storeInfo[0] + (2*i+1)*storeInfo[1]; for (int j = 3; j <= N; j++){ val += storeInfo[j-1]; } for (int j = 1; j <= i; j++){ val -= storeInfo[N+1-2*j-1]; } storeVal.push_back(val); } return; } void findMin(){ for (vector<int>::size_type i = 0; i < storeVal.size(); i++){ ans = min(ans,storeVal[i]); } } int main(){ int n; cin >> n; for (int i = 0; i < n; i++){ int num; cin >> num; storeInfo.push_back(num); } sort(storeInfo.begin(),storeInfo.end()); calc(); findMin(); cout << ans << endl; return 0; } ``` 이 코드는 일단 kattis에 있는 체점 데이터는 모두 통과합니다.
5 18개 문자 추가 6개 문자 삭제

2016年06月27日 11:51

pahkey

이 문제에 관한 흥미로운 페이퍼가 있습니다 <a href = "http://page.mi.fu-berlin.de/rote/Papers/pdf/Crossing+the+bridge+at+night.pdf"> 링크 </a>. 저는 여기에 서술한 알고리즘을 기반으로 코드를 짰어요. C++입니다. <a href = "https://github.com/iljimae0418/SLPC-problems/blob/master/safepassage.cpp"> 코드 </a>. 이 코드는 일단 kattis에 있는 체점 데이터는 모두 통과합니다.</div>
이 문제에 관한 흥미로운 페이퍼가 있습니다 <a href = "http://page.mi.fu-berlin.de/rote/Papers/pdf/Crossing+the+bridge+at+night.pdf"> 링크 </a>. 저는 여기에 서술한 알고리즘을 기반으로 코드를 짰어요. C++입니다. <a href = "https://github.com/iljimae0418/SLPC-problems/blob/master/safepassage.cpp"> 코드 </a>. 이 코드는 일단 kattis에 있는 체점 데이터는 모두 통과합니다.</div>
이 문제에 관한 흥미로운 페이퍼가 있습니다 <a href = "http://page.mi.fu-berlin.de/rote/Papers/pdf/Crossing+the+bridge+at+night.pdf"> 링크 </a>. 저는 여기에 서술한 알고리즘을 기반으로 코드를 짰어요. C++입니다. <a href = "https://github.com/iljimae0418/SLPC-problems/blob/master/safepassage.cpp"> 코드 </a>. 이 코드는 일단 kattis에 있는 체점 데이터는 모두 통과합니다.</div>
4 312개 문자 삭제

2016年06月27日 11:51

pahkey

<p> <div id="spoiler" style="display:block"> 이 문제에 관한 흥미로운 페이퍼가 있습니다 <a href = "http://page.mi.fu-berlin.de/rote/Papers/pdf/Crossing+the+bridge+at+night.pdf"> 링크 </a>. 저는 여기에 서술한 알고리즘을 기반으로 코드를 짰어요. C++입니다. <a href = "https://github.com/iljimae0418/SLPC-problems/blob/master/safepassage.cpp"> 코드 </a>. 이 코드는 일단 kattis에 있는 체점 데이터는 모두 통과합니다.</div> <button title="Click to show/hide content" type="button" onclick="if(document.getElementById('spoiler') .style.display=='none') {document.getElementById('spoiler') .style.display=''}else{document.getElementById('spoiler') .style.display='none'}">풀이</button> </p>
<p> <div id="spoiler" style="display:block"> 이 문제에 관한 흥미로운 페이퍼가 있습니다 <a href = "http://page.mi.fu-berlin.de/rote/Papers/pdf/Crossing+the+bridge+at+night.pdf"> 링크 </a>. 저는 여기에 서술한 알고리즘을 기반으로 코드를 짰어요. C++입니다. <a href = "https://github.com/iljimae0418/SLPC-problems/blob/master/safepassage.cpp"> 코드 </a>. 이 코드는 일단 kattis에 있는 체점 데이터는 모두 통과합니다.</div> <button title="Click to show/hide content" type="button" onclick="if(document.getElementById('spoiler') .style.display=='none') {document.getElementById('spoiler') .style.display=''}else{document.getElementById('spoiler') .style.display='none'}">풀이</button> </p>
<p> <div id="spoiler" style="display:block"> 이 문제에 관한 흥미로운 페이퍼가 있습니다 <a href = "http://page.mi.fu-berlin.de/rote/Papers/pdf/Crossing+the+bridge+at+night.pdf"> 링크 </a>. 저는 여기에 서술한 알고리즘을 기반으로 코드를 짰어요. C++입니다. <a href = "https://github.com/iljimae0418/SLPC-problems/blob/master/safepassage.cpp"> 코드 </a>. 이 코드는 일단 kattis에 있는 체점 데이터는 모두 통과합니다.</div> <button title="Click to show/hide content" type="button" onclick="if(document.getElementById('spoiler') .style.display=='none') {document.getElementById('spoiler') .style.display=''}else{document.getElementById('spoiler') .style.display='none'}">풀이</button> </p>
3 5개 문자 추가 4개 문자 삭제

2016年06月27日 11:50

pahkey

<p> <div id="spoiler" style="display:noneblock"> 이 문제에 관한 흥미로운 페이퍼가 있습니다 <a href = "http://page.mi.fu-berlin.de/rote/Papers/pdf/Crossing+the+bridge+at+night.pdf"> 링크 </a>. 저는 여기에 서술한 알고리즘을 기반으로 코드를 짰어요. C++입니다. <a href = "https://github.com/iljimae0418/SLPC-problems/blob/master/safepassage.cpp"> 코드 </a>. 이 코드는 일단 kattis에 있는 체점 데이터는 모두 통과합니다.</div> <button title="Click to show/hide content" type="button" onclick="if(document.getElementById('spoiler') .style.display=='none') {document.getElementById('spoiler') .style.display=''}else{document.getElementById('spoiler') .style.display='none'}">풀이</button> </p>
<p> <div id="spoiler" style="display:noneblock"> 이 문제에 관한 흥미로운 페이퍼가 있습니다 <a href = "http://page.mi.fu-berlin.de/rote/Papers/pdf/Crossing+the+bridge+at+night.pdf"> 링크 </a>. 저는 여기에 서술한 알고리즘을 기반으로 코드를 짰어요. C++입니다. <a href = "https://github.com/iljimae0418/SLPC-problems/blob/master/safepassage.cpp"> 코드 </a>. 이 코드는 일단 kattis에 있는 체점 데이터는 모두 통과합니다.</div> <button title="Click to show/hide content" type="button" onclick="if(document.getElementById('spoiler') .style.display=='none') {document.getElementById('spoiler') .style.display=''}else{document.getElementById('spoiler') .style.display='none'}">풀이</button> </p>
<p> <div id="spoiler" style="display:noneblock"> 이 문제에 관한 흥미로운 페이퍼가 있습니다 <a href = "http://page.mi.fu-berlin.de/rote/Papers/pdf/Crossing+the+bridge+at+night.pdf"> 링크 </a>. 저는 여기에 서술한 알고리즘을 기반으로 코드를 짰어요. C++입니다. <a href = "https://github.com/iljimae0418/SLPC-problems/blob/master/safepassage.cpp"> 코드 </a>. 이 코드는 일단 kattis에 있는 체점 데이터는 모두 통과합니다.</div> <button title="Click to show/hide content" type="button" onclick="if(document.getElementById('spoiler') .style.display=='none') {document.getElementById('spoiler') .style.display=''}else{document.getElementById('spoiler') .style.display='none'}">풀이</button> </p>
2 39개 문자 추가

2016年06月08日 14:09

iljimae

<p> <div id="spoiler" style="display:none"> 이 문제에 관한 흥미로운 페이퍼가 있습니다 <a href = "http://page.mi.fu-berlin.de/rote/Papers/pdf/Crossing+the+bridge+at+night.pdf"> 링크 </a>. 저는 여기에 서술한 알고리즘을 기반으로 코드를 짰어요. C++입니다. <a href = "https://github.com/iljimae0418/SLPC-problems/blob/master/safepassage.cpp"> 코드 </a>. 이 코드는 일단 kattis에 있는 체점 데이터는 모두 통과합니다.</div> <button title="Click to show/hide content" type="button" onclick="if(document.getElementById('spoiler') .style.display=='none') {document.getElementById('spoiler') .style.display=''}else{document.getElementById('spoiler') .style.display='none'}">풀이</button> </p>
<p> <div id="spoiler" style="display:none"> 이 문제에 관한 흥미로운 페이퍼가 있습니다 <a href = "http://page.mi.fu-berlin.de/rote/Papers/pdf/Crossing+the+bridge+at+night.pdf"> 링크 </a>. 저는 여기에 서술한 알고리즘을 기반으로 코드를 짰어요. C++입니다. <a href = "https://github.com/iljimae0418/SLPC-problems/blob/master/safepassage.cpp"> 코드 </a>. 이 코드는 일단 kattis에 있는 체점 데이터는 모두 통과합니다.</div> <button title="Click to show/hide content" type="button" onclick="if(document.getElementById('spoiler') .style.display=='none') {document.getElementById('spoiler') .style.display=''}else{document.getElementById('spoiler') .style.display='none'}">풀이</button> </p>
<p> <div id="spoiler" style="display:none"> 이 문제에 관한 흥미로운 페이퍼가 있습니다 <a href = "http://page.mi.fu-berlin.de/rote/Papers/pdf/Crossing+the+bridge+at+night.pdf"> 링크 </a>. 저는 여기에 서술한 알고리즘을 기반으로 코드를 짰어요. C++입니다. <a href = "https://github.com/iljimae0418/SLPC-problems/blob/master/safepassage.cpp"> 코드 </a>. 이 코드는 일단 kattis에 있는 체점 데이터는 모두 통과합니다.</div> <button title="Click to show/hide content" type="button" onclick="if(document.getElementById('spoiler') .style.display=='none') {document.getElementById('spoiler') .style.display=''}else{document.getElementById('spoiler') .style.display='none'}">풀이</button> </p>
1 Original

2016年06月08日 14:06

iljimae

<p> <div id="spoiler" style="display:none"> 이 문제에 관한 흥미로운 페이퍼가 있습니다 <a href = "http://page.mi.fu-berlin.de/rote/Papers/pdf/Crossing+the+bridge+at+night.pdf"> 링크 </a>. 저는 여기에 서술한 알고리즘을 기반으로 코드를 짰어요. C++입니다. <a href = "https://github.com/iljimae0418/SLPC-problems/blob/master/safepassage.cpp"> 코드 </a></div> <button title="Click to show/hide content" type="button" onclick="if(document.getElementById('spoiler') .style.display=='none') {document.getElementById('spoiler') .style.display=''}else{document.getElementById('spoiler') .style.display='none'}">풀이</button> </p>
<p> <div id="spoiler" style="display:none"> 이 문제에 관한 흥미로운 페이퍼가 있습니다 <a href = "http://page.mi.fu-berlin.de/rote/Papers/pdf/Crossing+the+bridge+at+night.pdf"> 링크 </a>. 저는 여기에 서술한 알고리즘을 기반으로 코드를 짰어요. C++입니다. <a href = "https://github.com/iljimae0418/SLPC-problems/blob/master/safepassage.cpp"> 코드 </a></div> <button title="Click to show/hide content" type="button" onclick="if(document.getElementById('spoiler') .style.display=='none') {document.getElementById('spoiler') .style.display=''}else{document.getElementById('spoiler') .style.display='none'}">풀이</button> </p>
코딩도장

코딩도장은 프로그래밍 문제풀이를 통해서 코딩 실력을 수련(Practice)하는 곳입니다.

코딩도장 © 2014 · 문의 [email protected]
피드백 · 개인정보취급방침 · RSS

AltStyle によって変換されたページ (->オリジナル) /