반응형
jungol 191부터 jungol 200까지 c언어로 작성된 코드입니다.
참고해 주시면 좋을 것 같습니다.
jungol 191
#define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
int main(void)
{
int i;
int j;
char c[50][100] = { 0, };
i = 0;
j = 0;
for (i = 0; i < 50; i++)
{
scanf("%s", c[i]);
if (c[i][0] == '0')
break;
j++;
}
printf("%d\n", j);
for (i = 0; i < j; i = i + 2)
{
printf("%s\n", c[i]);
}
return 0;
}
jungol 192
#define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
#include <string.h>
int main(void)
{
int n;
char t[100];
char c1[10][100] = { 0, };
scanf("%d", &n);
for (int i = 0; i < n; i++)
{
scanf("%s", c1[i]);
}
for (int i = 0; i < n; i++)
{
for (int j = i; j < n; j++)
{
if (strcmp(c1[i], c1[j]) > 0)
{
strcpy(t, c1[i]);
strcpy(c1[i], c1[j]);
strcpy(c1[j], t);
}
}
}
for (int i = 0; i < n; i++)
{
printf("%s\n", c1[i]);
}
return 0;
}
jungol 193
#define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
#include <string.h>
int main(void)
{
int i=0, k=0;
char c[50][100]={0,};
char c1[100]={0,};
char d = 0;
for(i = 0; i < 5; i++)
{
scanf(" %s", c[i]);
}
scanf(" %c %s",&d, &c1);
for(i = 0; i < 5; i++)
{
if(strchr(c[i], d) != 0 || strstr(c[i], c1) != 0)
{
printf("%s\n",c[i]);
k=1;
}
}
if(k==0)
{
printf("none");
}
return 0;
}
jungol 194
#define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
#include <string.h>
int main(void)
{
int n;
char A[20], B[20];
scanf("%s %s %d", A, B, &n);
strcat(A, B);
strncpy(B, A, n);
printf("%s\n", A);
printf("%s\n", B);
return 0;
}
jungol 195
#define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
struct Person
{
char name[100];
char tel[100];
char addr[100];
};
int main(void)
{
struct Person p1;
scanf("%s %s %s", p1.name, p1.tel, p1.addr);
printf("name : %s\ntel : %s\naddr : %s\n", p1.name, p1.tel, p1.addr);
return 0;
}
jungol 196
#define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
#include <string.h>
struct Person
{
char name[15];
char tel[15];
char addr[15];
};
int main(void)
{
struct Person p[3];
int arr = 0;
for (int i = 0; i < 3; i++)
{
scanf("%s %s %s", p[i].name, p[i].tel, p[i].addr);
}
if (strcmp(p[0].name, p[1].name) > 0)
{
if (strcmp(p[1].name, p[2].name) > 0)
arr = 2;
else
arr = 1;
}
else
{
if (strcmp(p[0].name, p[2].name) > 0)
arr = 2;
else
arr = 0;
}
printf("name : %s\ntel : %s\naddr : %s\n", p[arr].name, p[arr].tel, p[arr].addr);
return 0;
}
jungol 197
#define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
struct axis
{
int x1;
int y1;
int x2;
int y2;
};
int main(void)
{
struct axis s1;
struct axis s2;
scanf("%d %d %d %d", &s1.x1, &s1.y1, &s1.x2, &s1.y2);
scanf("%d %d %d %d", &s2.x1, &s2.y1, &s2.x2, &s2.y2);
if (s1.x1 < s2.x1)
printf("%d ", s1.x1);
else
printf("%d ", s2.x1);
if (s1.y1 < s2.y1)
printf("%d ", s1.y1);
else
printf("%d ", s2.y1);
if (s1.x2 > s2.x2)
printf("%d ", s1.x2);
else
printf("%d ", s2.x2);
if (s1.y2 > s2.y2)
printf("%d ", s1.y2);
else
printf("%d \n", s2.y2);
return 0;
}
jungol 198
#define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
#include <math.h>
struct heredity
{
int F_h;
int M_h;
float F_w;
float M_w;
};
int main(void)
{
struct heredity p1;
scanf("%d %f", &p1.F_h, &p1.F_w);
scanf("%d %f", &p1.M_h, &p1.M_w);
printf("height : %.0fcm\nweight : %.1fkg\n", floor(((float)p1.F_h + p1.M_h) / 2 + 5), (p1.M_w + p1.F_w) / 2 - 4.5);
return 0;
}
jungol 199
#define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
struct score
{
int A;
int B;
int C;
int sum;
char name[20];
};
int main(void)
{
int n = 0;
struct score s[10];
scanf("%d", &n);
for (int i = 0; i < n; i++)
{
scanf("%s %d %d %d", s[i].name, &s[i].A, &s[i].B, &s[i].C);
s[i].sum = s[i].A + s[i].B + s[i].C;
}
for (int i = 0; i < n; i++)
{
for (int j = i; j < n; j++)
{
if (s[i].sum < s[j].sum)
{
struct score tmp = s[i];
s[i] = s[j];
s[j] = tmp;
}
}
}
for (int i = 0; i < n; i++)
{
printf("%s %d %d %d %d\n", s[i].name, s[i].A, s[i].B, s[i].C, s[i].sum);
}
return 0;
}
jungol 200
#define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
int main(void)
{
int n1;
float n2;
printf("%p %p\n", &n1, &n2);
return 0;
}
반응형
'Algorithm > JUNGOL' 카테고리의 다른 글
C언어, JUNGOL 601 ~ 610 (2) | 2023.11.30 |
---|---|
C언어, JUNGOL 9101 ~ 9110 (0) | 2023.11.29 |
C언어, JUNGOL 591 ~ 600 (0) | 2023.11.27 |
C언어, JUNGOL 9091 ~ 9100 (4) | 2023.11.26 |
C언어, JUNGOL 181 ~ 190 (4) | 2023.11.25 |