분류 전체보기

알고리즘 문제 풀이/1DP_과제(~180615)

171026_1094_막대기

#include using namespace std; int main(){ int goal; cin >> goal; int t_length=64; int sht=64; int cnt=1; while(t_length>goal) { sht/=2; cnt++; if(t_length-sht>=goal) {t_length-=sht;cnt--;} } cout while(t_length>goal)가지고 있는 막대 중 길이가 가장 짧은 것을 절반으로 자른다. ->sht/=2; 개수는 1개가 2개가 되니 cnt++;만약, 위에서 자른 막대의 절반 중 하나를 버리고 남아있는 막대의 길이의 합이 X보다 크거나 같다면 ->if(t_length-sht>=goal) , 위에서 자른 막대의 절반 중 하나를 버린다. -> t_len..

알고리즘 문제 풀이/1DP_과제(~180615)

171026_2455_지능형 기차

#include using namespace std; int main(){ int max=0; int n=0; for(int i=0; i> x; n-=x; if(max> x; n+=x; if(max

알고리즘 문제 풀이/1DP_과제(~180615)

171025_2096_내려가기

#include using namespace std;int max(int a, int b){return a > b ? a : b;}int max(int a, int b, int c){return max(a, b) > c ? max(a, b) : c;}int min(int a, int b){return a > N;int max_arr[2][3] = { 0 };int min_arr[2][3] = { 0 };int input[3] = { 0 }; for (int i = 1; i > input[0] >> input[1] >> in..

알고리즘 문제 풀이/1DP_과제(~180615)

171024_최빈수구하기

#include using namespace std; int main(){ for(int i=1; i> case_number; cin >> mode; score[mode]++; for(int j=0; j> x; score[x]++; if(score[x]>score[mode]) mode = x; if(score[x]==score[mode]) mode = mode > x ? mode : x; } cout

bong sue
'분류 전체보기' 카테고리의 글 목록 (60 Page)