목록Algorithm/구현 | ETC (50)
:: ADVANCE ::
dovelet 28 단계 나머지 연산자 cd 굽기 (cdrw) http://59.23.113.171/30stair/cdrw/cdrw.php?pname=cdrw 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 #include int cdrw[20] = { 0, 1, 2, 3, 3, 4, 4, 5, 5, 6, 7, 8, 8, 9, 9, 10, 11, 12, 12, 12, }; int main(void) { int n, t; scanf("%d", &n); t = (n / 19) * 12 + cdrw[n % 19]; printf("%d\n", t); return 0; } cs
dovelet 13 단계 stack 괄호의 값 (paren) http://59.23.113.171/30stair/paren/paren.php?pname=paren 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 #include #include char input[50]; char stack[50]; int out[50]; int main(void) { int i, result = 0, n = 0, index = 0; gets(input); for (i = 0; i
dovelet 3 단계 for 소다수 (ncpc_soda) http://59.23.113.171/30stair/ncpc_soda/ncpc_soda.php?pname=ncpc_soda 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 #include int main(void) { int have, pick, need, temp; int namerge = 0, mok = 0, drink = 0; scanf("%d%d%d", &have, &pick, &need); mok = (have + pick) / need; namerge = (have + pick) % need; while (mok != 0) { drink += mok; temp = mok + name..
dovelet 9단계 재귀 뒤집어 더하기 (radd) http://59.23.113.171/30stair/radd/radd.php?pname=radd 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 #include int radd(int n) { int temp = 0; while (n) { temp = temp * 10 + n % 10; n /= 10; } return temp; } int main(void) { int n, m; scanf("%d%d", &n, &m); printf("%d\n", radd(radd(n) + radd(m))); return 0; } cs
dovelet 9 단계 재귀 네 수의 합 (hap) http://59.23.113.171/30stair/hap/hap.php?pname=hap 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 #include int hap(int a, int b) { return a + b; } int main(void) { int num[4], i; for (i = 0; i
dovelet 9 단계 재귀 big dance (dance) http://59.23.113.171/30stair/dance/dance.php?pname=dance 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 #include int sum; void dance(int start, int end, int n) { int temp; if (start == end-1) { sum += start * end; return; } if (start == end) return; temp = start + (n - 1) / 2; dance(start, temp, temp - start + 1); temp += 1; ..
dovelet 8 단계 함수 13일의 금요일 (friday) http://59.23.113.171/30stair/friday/friday.php?pname=friday 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 #include int monthend[13] = { 0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 }; int day[7]; int main(void) { int n; int year, month, date, count = 2; scanf("%d", &n); for (year = 1900; year
dovelet 2 단계 if 두 현의 교차 유무 (cross) http://59.23.113.171/30stair/cross/cross.php?pname=cross 123456789101112131415161718192021222324252627282930313233#include using namespace std; int main(void){ int n1, n2, m1, m2, temp; cin >> n1 >> n2; cin >> m1 >> m2; if (n1 > n2) { temp = n2; n2 = n1; n1 = temp; } temp = 0; if (n1
dovelet 4 단계 다중 반복문 제곱수 만들기 (make_square) http://59.23.113.171/30stair/make_square/make_square.php?pname=make_square 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 #include using namespace std; void func(int n) { int i, j; for(i = 1; i
dovelet 4 단계 다중 반복문 이벤트 (ncpc_event) http://59.23.113.171/30stair/ncpc_event/ncpc_event.php?pname=ncpc_event 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 #include using namespace std; int main(void) { int n, total, hotel, week, temp, min = 999999; int pri[20], inwon[15]; cin >> n >> total >> hotel >> week; for(int i = 0; i > pri[i]; for(int j = 0; j >..