Describe 새싹교실/2020/이찌반/전성수 here
약수의 합
#include <stdio.h>
#include <stdbool.h>
#include <stdlib.h>
약수의 합
#include <stdio.h>
#include <stdbool.h>
#include <stdlib.h>
int solution(int n) {
int answer = 0;
for (int i = n; i > 0; i--) {
return answer;
}for (int i = n; i > 0; i--) {
if (n % i == 0) {
else continue;
}answer += i;
}else continue;
return answer;
하샤드수
#include <stdio.h>
#include <stdbool.h>
#include <stdlib.h>
#include <stdio.h>
#include <stdbool.h>
#include <stdlib.h>
bool solution(int x) {
bool answer = true;
int sum = 0;
while (1) {
if (x % sum == 0) answer = true;
else answer = false;
return answer;
}int sum = 0;
while (1) {
sum += x % 10;
if (x / 10 < 10) {
else {
}if (x / 10 < 10) {
sum += x / 10;
break;
}break;
else {
x /= 10;
}if (x % sum == 0) answer = true;
else answer = false;
return answer;
수박수박수
//하샤드 수
#include <stdio.h>
#include <stdbool.h>
#include <stdlib.h>
//하샤드 수
#include <stdio.h>
#include <stdbool.h>
#include <stdlib.h>
bool solution(int x) {
bool answer = true;
int sum = 0;
while (1) {
if (x % sum == 0) answer = true;
else answer = false;
return answer;
}int sum = 0;
while (1) {
sum += x % 10;
if (x / 10 < 10) {
else {
}if (x / 10 < 10) {
sum += x / 10;
break;
}break;
else {
x /= 10;
}if (x % sum == 0) answer = true;
else answer = false;
return answer;
두개 뽑아서 더하기
#include <stdio.h>
#include <stdbool.h>
#include <stdlib.h>
#define SWAP(a, b) {int t = a; a = b; b = t;}
#include <stdio.h>
#include <stdbool.h>
#include <stdlib.h>
#define SWAP(a, b) {int t = a; a = b; b = t;}
int* solution(int numbers[], size_t numbers_len) {
int length = 0;
int* answer = (int*)malloc(sizeof(int) * 100);
for (int i = 0; i < numbers_len - 1; i++) {
for (int i = 0; i < length; i++) {
}
return answer;
}int* answer = (int*)malloc(sizeof(int) * 100);
for (int i = 0; i < numbers_len - 1; i++) {
for (int j = i + 1; j < numbers_len; j++) {
}int add = numbersi + numbersj;
int check = 1;
for (int k = 0; k < length; k++) {
if (check == 1) {
}
}int check = 1;
for (int k = 0; k < length; k++) {
if (answerk == add) check = 0;
}if (check == 1) {
}
for (int i = 0; i < length; i++) {
}
return answer;
- 별찍기
//별찍기
#include <stdio.h>
//별찍기
#include <stdio.h>
int main(void) {
int a;
int b;
scanf_s("%d %d", &a, &b);
printf("%d\n", a + b);
for (int i = 0; i < b; i++) {
return 0;
}int b;
scanf_s("%d %d", &a, &b);
printf("%d\n", a + b);
for (int i = 0; i < b; i++) {
for (int j = 0; j < a; j++) {
printf("\n");
}printf("*");
}printf("\n");
return 0;
문자열 정렬
#include <stdio.h>
#include <stdbool.h>
#include <stdlib.h>
#include <string.h>
#define SWAP(a,b) {int t = a;a = b;b = t;}
char* solution(const char* s) {
#include <stdio.h>
#include <stdbool.h>
#include <stdlib.h>
#include <string.h>
#define SWAP(a,b) {int t = a;a = b;b = t;}
char* solution(const char* s) {
int cnt = strlen(s);
char* answer = (char*)malloc(sizeof(char) * cnt);
for (int i = 0; i <= cnt; i++) {
}
for (int i = 0; i < cnt; i++) {
}
return answer;
}char* answer = (char*)malloc(sizeof(char) * cnt);
for (int i = 0; i <= cnt; i++) {
}
for (int i = 0; i < cnt; i++) {
}
return answer;
문자열을 정수로 바꾸기
#include <stdio.h>
#include <stdbool.h>
#include <stdlib.h>
#include <stdio.h>
#include <stdbool.h>
#include <stdlib.h>
int solution(const char* s) {
int answer = 0;
answer = atoi(s);
return answer;
}answer = atoi(s);
return answer;
문자열 다루기
#include <stdio.h>
#include <stdbool.h>
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
#include <stdio.h>
#include <stdbool.h>
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
bool solution(const char* s) {
bool answer = true;
int count = strlen(s);
for (int i = 0; i < count; i++) {
}
if ((count == 4 || count == 6) != 1) {
return answer;
}int count = strlen(s);
for (int i = 0; i < count; i++) {
}
if ((count == 4 || count == 6) != 1) {
answer = false;
}return answer;
두 정수 사이의 합
#include <stdio.h>
#include <stdbool.h>
#include <stdlib.h>
#include <stdio.h>
#include <stdbool.h>
#include <stdlib.h>
long long solution(int a, int b) {
long long answer = 0;
long long sum = 0;
if (a > b) {
else if (a < b) {
else {
return answer;
}long long sum = 0;
if (a > b) {
for (int i = b; i <= a; i++) {
answer = sum;
}sum += i;
}answer = sum;
else if (a < b) {
for (int i = a; i <= b; i++) {
answer = sum;
}sum += i;
}answer = sum;
else {
answer = a;
}return answer;
가운데 글자 가져오기
#include <stdio.h>
#include <stdbool.h>
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
#include <stdbool.h>
#include <stdlib.h>
#include <string.h>
char* solution(const char* s) {
char* answer;
int cnt = strlen(s);
if (cnt % 2) {
}
else {
return answer;
}int cnt = strlen(s);
if (cnt % 2) {
}
else {
answer = (char*)malloc(sizeof(char) * 2);
answer0 = s(cnt / 2) - 1;
answer1 = scnt / 2;
answer2 = '\0';
}answer0 = s(cnt / 2) - 1;
answer1 = scnt / 2;
answer2 = '\0';
return answer;
2016년
#include <stdio.h>
#include <stdbool.h>
#include <stdlib.h>
//5. 24(1,2,3,4,
char* solution(int a, int b) {
#include <stdio.h>
#include <stdbool.h>
#include <stdlib.h>
//5. 24(1,2,3,4,
char* solution(int a, int b) {
// 리턴할 값은 메모리를 동적 할당해주세요.
char* answer = (char*)malloc(sizeof(char) * 10);
int day = b;
int month[] = { 31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 };
for (int i = 0; i < a; i++) {
switch (day % 7) {
case 0: answer = "THU"; break;
case 1: answer = "FRI"; break;
case 2: answer = "SAT"; break;
case 3: answer = "SUN"; break;
case 4: answer = "MON"; break;
case 5: answer = "TUE"; break;
case 6: answer = "WED"; break;
}
return answer;
}char* answer = (char*)malloc(sizeof(char) * 10);
int day = b;
int month[] = { 31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 };
for (int i = 0; i < a; i++) {
day += monthi - 1;
}switch (day % 7) {
case 0: answer = "THU"; break;
case 1: answer = "FRI"; break;
case 2: answer = "SAT"; break;
case 3: answer = "SUN"; break;
case 4: answer = "MON"; break;
case 5: answer = "TUE"; break;
case 6: answer = "WED"; break;
}
return answer;