-
For Loop코딩 테스트/HackerRank 2021. 9. 16. 23:44
https://www.hackerrank.com/challenges/c-tutorial-for-loop/problem For Loop | HackerRank Learn how to use for loop and print the output as per the given conditions www.hackerrank.com #include #include using namespace std; string numbers[10] = {"zero", "one", "two", "three", "four", "five", "six", "seven", "eight", "nine"}; int main() { // Complete the code. int num, sum; cin >> num >> sum; for (i..
-
Functions코딩 테스트/HackerRank 2021. 9. 15. 21:57
https://www.hackerrank.com/challenges/c-tutorial-functions/problem Functions | HackerRank Learn how to write functions in C++. Create a function to find the maximum of the four numbers. www.hackerrank.com #include #include using namespace std; /* Add `int max_of_four(int a, int b, int c, int d)` here. */ int max_of_four(int a, int b, int c, int d) { int temp1, temp2; if (a > b) temp1 = a; else t..
-
Pointer코딩 테스트/HackerRank 2021. 9. 14. 22:35
https://www.hackerrank.com/challenges/c-tutorial-pointer/problem Pointer | HackerRank Learn how to declare pointers and use them. www.hackerrank.com #include #include void update(int *a,int *b) { // Complete this function int tempSum, tempAbs; tempSum = *a + *b; tempAbs = abs(*a - *b); *a = tempSum; *b = tempAbs; } int main() { int a, b; int *pa = &a, *pb = &b; scanf("%d %d", &a, &b); update(pa,..
-
Print the Elements of a Linked List코딩 테스트/HackerRank 2021. 9. 13. 23:30
https://www.hackerrank.com/challenges/print-the-elements-of-a-linked-list/problem Print the Elements of a Linked List | HackerRank Get started with Linked Lists! www.hackerrank.com // ... void printLinkedList(SinglyLinkedListNode* head) { while(head != nullptr) { cout data next; } } // ...
-
부족한 금액 계산하기코딩 테스트/프로그래머스 2021. 8. 25. 19:23
https://programmers.co.kr/learn/courses/30/lessons/82612 코딩테스트 연습 - 1주차_부족한 금액 계산하기 새로 생긴 놀이기구는 인기가 매우 많아 줄이 끊이질 않습니다. 이 놀이기구의 원래 이용료는 price원 인데, 놀이기구를 N 번 째 이용한다면 원래 이용료의 N배를 받기로 하였습니다. 즉, 처음 이 programmers.co.kr 문제 이해 -> 놀이기구를 n번째 이용한다면 원래 이용료의 n배를 받음 -> 놀이기구를 count번 타게 되면 자신의 금액에서 얼마가 모자라는지 반환 문제 주의 -> 이용료는 자연수이며 1이상 2,500이하 -> 처음 가지고 있는 금액은 자연수이며 1이상 1,000,000,000이하 -> 놀이기구 이용 횟수는 자연수이며 1이상 2..