문 ¶
1.koistudy
112-113
#include<stdio.h>
112-113
#include<stdio.h>
int main()
{
{
int r,e,c;
scanf("%d %d %d",&r,&e,&c);
if(r< e-c){
}scanf("%d %d %d",&r,&e,&c);
if(r< e-c){
printf("advertise\n");
}else if(r>e-c){printf("do not advertise\n");
}else if(r==e-c){printf("does not matter\n");
}#include<stdio.h>
#include<math.h>
int main()
{
int a,b,c;
double x1,x2;
#include<math.h>
int main()
{
int a,b,c;
double x1,x2;
scanf("%d %d %d", &a,&b,&c);
x1=(-b+sqrt(b*b-(4*a*c)))/(2*a);
x2=(-b-sqrt(b*b-(4*a*c)))/(2*a);
if(x1==x2){
printf("%g ",x1);
}else if(x1 !=x2){
if(x1>x2)
}
return 0;
}x1=(-b+sqrt(b*b-(4*a*c)))/(2*a);
x2=(-b-sqrt(b*b-(4*a*c)))/(2*a);
if(x1==x2){
printf("%g ",x1);
}else if(x1 !=x2){
if(x1>x2)
printf("%g %g",x1,x2);
else if(x1printf("%g %g",x2,x1);
return 0;
/*115-
#include<stdio.h>
#include<stdio.h>
int main(){
*/
int a;
int sum=0;
scanf("%d",&a);
for(;a >1;a--){
printf("%d",sum+1);
return 0;
}int sum=0;
scanf("%d",&a);
for(;a >1;a--){
sum+=a;
}printf("%d",sum+1);
return 0;
*/
/* 116-
#include<stdio.h>
int main(){
*/
#include<stdio.h>
int main(){
int n,k;
int i=1;
int sum=0;
scanf("%d %d",&n,&k);
while(i<=n){
printf("%d",sum);
return 0;
}int i=1;
int sum=0;
scanf("%d %d",&n,&k);
while(i<=n){
if(i%k ==0){
i++;
}sum+=i;
}i++;
printf("%d",sum);
return 0;
*/
/*119-
#include<stdio.h>
int main(){
*/
#include<stdio.h>
int main(){
int a;
int count=0;
scanf("%d",&a);
a= a*2-1;
for(count=0;count < a;count++)
printf("*");
return 0;
}int count=0;
scanf("%d",&a);
a= a*2-1;
for(count=0;count < a;count++)
printf("*");
return 0;
*/
/*120-
#include<stdio.h>
int main(){
}
*/
#include<stdio.h>
int main(){
}
*/
/*121-
#include<stdio.h>
int main(){
*/
#include<stdio.h>
int main(){
int a;
int i,j;
scanf("%d",&a);
for(i=0;i
printf("\n");
}
for(i=0;i
printf("\n");
}
return 0;
}int i,j;
scanf("%d",&a);
for(i=0;i
for(j=0;j
printf("*");
}printf("\n");
}
for(i=0;i
for(j=a;j>i+1;j--){
printf("*");
}printf("\n");
}
return 0;
*/
122-#include<stdio.h>
int main()
{
{
int a;
int i,j;
scanf("%d",&a);
if(a!=1){
for(i=1;i<10;i++){
printf("%d*%d=%d\n",a,i,a*i);
}
}else if(a==1){
}
}int i,j;
scanf("%d",&a);
if(a!=1){
for(i=1;i<10;i++){
printf("%d*%d=%d\n",a,i,a*i);
}
}else if(a==1){
for(i=1;i<10;i++){
}for(j=2;j<10;j++){
printf("%d*%d=%d ",j,i,j*i);
}printf("%d*%d=%d ",j,i,j*i);
printf("\n");
}
return 0;
2.Swap
--#include<stdio.h>
void swap(int *a,int *b);
int main()
{
int main()
{
char x='A',y='B';
printf("x= %c y=%c\n",x,y);swap(&x,&y);
printf("x=%c ,y=%c\n",x,y);
return 0;
printf("x=%c ,y=%c\n",x,y);
return 0;
}
void swap(int *a,int *b)
{
void swap(int *a,int *b)
{
int temp;
temp=*a;
*a=*b;temp=*a;
*b=temp;
}
int sp=0;
int push(int);
int pop(int *);
int push(int);
int pop(int *);
int main(){
int n=0;
push(3);
push(4);
push(6);
push(7);
push(9);
push(3);
push(2);
if (push(40) == -1)
{
push(3);
push(4);
push(6);
push(7);
push(9);
push(3);
push(2);
if (push(40) == -1)
{
printf("Stack Overflow\n");
}
pop(&n);
printf("pop : %d\n",n);
pop(&n);
printf("pop : %d\n",n);
pop(&n);
printf("pop : %d\n",n);
printf("pop : %d\n",n);
pop(&n);
printf("pop : %d\n",n);
pop(&n);
printf("pop : %d\n",n);
pop(&n);
printf("pop : %d\n",n);
pop(&n);
printf("pop : %d\n",n);
pop(&n);
printf("pop : %d\n",n);
printf("pop : %d\n",n);
pop(&n);
printf("pop : %d\n",n);
pop(&n);
printf("pop : %d\n",n);
pop(&n);
printf("pop : %d\n",n);
pop(&n);
printf("pop : %d\n",n);
if(pop(&n) == -1)
{
printf("Stack Underflow\n");
{
printf("Stack Underflow\n");
}
return 0;
}
return 0;
}
}else
{
{
return -1; // �姨�£≫納�overflow
}}
}else
{
return -1; //�≫ 納� underflow
{
return -1; //�≫ 納� underflow
}
}
}
1 2 3 4 5
16 17 18 19 6
15 24 25 20 7
14 23 22 21 8
13 12 11 10 9
16 17 18 19 6
15 24 25 20 7
14 23 22 21 8
13 12 11 10 9
- 5X5배 배, 1,2,3,4,5를 0 , 마막 4 4 , 마막 4 4 , 0 ( -1)만 ... 복....
¶
1.koistudy113번 못
2.Swap
#include<stdio.h> int swap(int *a,int *b); int main(void){ int a = 4; int b = 6; swap(&a,&b); printf("%d %d",a,b); return 0; } int swap(int *a,int *b){ int temp; temp= *a; *a = *b; *b = temp; return swap(a,b); }
4.BinarySearch 무 보, 능면 번 보 .(능면!)
- 대 방.
- 번 동 , 를 대(K
(K는 는 , Ki는 료 들)
- 들 대 배 는 는 방
- 미 데들 + 복 능 방.
만 데들 만 복 면 복 만 며,
데들 면 데를 못.
머는 무
¶
복
1.KoiStudy 112~113,115~122 - 문 많데 몇 .
- 113번 빼 모 료.
2.Swap #include <stdio.h> void swap(int*, int*); int main(){ int a=5; int b=2; printf("a:%d b:%d\n",a,b); swap(&a,&b); printf("a:%d b:%d\n",a,b); return 0; } void swap(int* x, int* y){ int temp; temp=*x; *x=*y; *y=temp; }
3.3,4,6,7,9,3,2를 2,3,9,7,6,4,3 는 램 보.()
#include <stdio.h> int main(){ int arr[7]={0,}; int n,i; for(i=0 ; i<7 ; i++){ scanf("%d",&n); arr[i]=n; } for(i=6 ; i>=0 ; i--){ printf("%d ",arr[i]); } printf("\n"); return 0; }
4.BinarySearch 무 보, 능면 번 보 .(능면!)
는 램 떻면 는 보 . 방 면 보
1 2 3 4 5
16 17 18 19 6
15 24 25 20 7
14 23 22 21 8
13 12 11 10 9
는 램 떻면 는 보 . 방 면 보
1 2 3 4 5
16 17 18 19 6
15 24 25 20 7
14 23 22 21 8
13 12 11 10 9
6.LinkedList를 는 를 만들, 를 linkedlist를 만들봅.
#include <stdio.h> #include <stdlib.h> struct Linkedlist{ int data; struct Linkedlist *next; }; int main(){ struct Linkedlist *p1 = (struct Linkedlist*)malloc(sizeof(struct Linkedlist)); struct Linkedlist *p2 = (struct Linkedlist*)malloc(sizeof(struct Linkedlist)); p1->data = 10; p1->next = p2; p2->data = 20; p2->next = NULL; printf("%d\n",p1->next->data); return 0; }
7.동 list 몇 는 를 만들봅. list->next->next = 동;
#include <stdio.h> #include <stdlib.h> struct Linkedlist{ int data; struct Linkedlist *next; }; int main(){ struct Linkedlist *p1 = (struct Linkedlist*)malloc(sizeof(struct Linkedlist)); p1->next=(struct Linkedlist*)malloc(sizeof(struct Linkedlist)); p1->next->next=(struct Linkedlist*)malloc(sizeof(struct Linkedlist)); p1->data=10; p1->next->data=20; p1->next->next->data=30; printf("%d\n",p1->data); printf("%d\n",p1->next->data); printf("%d\n",p1->next->next->data); return 0; }
8.LinkedList를 만들, 리 data 4,5,3,7,12,24,2,9 들 봅.
1.Koistudy163
2.163번 문를 , 문를 떻 는 말봅.
2.163번 문를 , 문를 떻 는 말봅.
#include <stdio.h> int main(){ char arr[9]; int n; int i; scanf("%d",&n); scanf("%s",arr); for(i=0 ; i<8 ; i++){ printf("%c",arr[i]+n); } printf("\n"); return 0; }
3.문 대 Palindrome, Not Palindrome 는 램 봅.
level, racecar, deed는 palindrome, sadfds는 not Palindrome
level, racecar, deed는 palindrome, sadfds는 not Palindrome
림 ¶
1.6.1.1 복
1.KoiStudy 112~113,115~122 - 문 많데 몇 .
2.Swap
.
.
1 2 3 4 5
16 17 18 19 6
15 24 25 20 7
14 23 22 21 8
13 12 11 10 9
#include <stdio.h> void Swap(int *a, int *b); int main() { int a=4; int b=9; printf("변 : a = %d, b = %d\n",a,b); Swap(&a,&b); printf("변 : a = %d, b = %d\n",a,b); return 0; } void Swap(int *a,int *b) { int temp; temp=*a; *a=*b; *b=temp; }3.3,4,6,7,9,3,2를 2,3,9,7,6,4,3 는 램 보.()
#include <stdio.h> int main() { int arr[7]; int sp=0; while(1) { if(sp==7) { break; } scanf("%d",&arr[sp++]); } while(1) { if(sp==0) break; printf("%d ",arr[--sp]); } return 0; }4.BinarySearch 무 보, 능면 번 보 .(능면!)
.
- 데 는 리 .
- 는 리 범를 1/2 는 방 문 붙 .
- 는 리 범를 1/2 는 방 문 붙 .
- 1. 데 는 를 릅.
- 2. 는 목 .
- 3. 목 보 면 데 대 면 른 대 .
- 4. 료 1 ~ 3번 복.
- 2. 는 목 .
- 3. 목 보 면 데 대 면 른 대 .
- 4. 료 1 ~ 3번 복.
#include <stdio.h> int binary (int arr[], int low, int high, int key); int main() { int arr[10]={1,3,13,15,16,17,22,26,32,50}; int key; int search; scanf("%d",&key); search=binary(arr,0,9,key); if(search==1) printf("Find"); else printf("Not Find"); return 0; } int binary(int arr[], int low, int high, int key) { int mid; while(low<=high) { mid=(low+high)/2; if(arr[mid]==key) return 1; else if(arr[mid]>key) high=mid-1; else low=mid+1; } return 0; }5. 는 램 떻면 는 보 . 방 면 보
1 2 3 4 5
16 17 18 19 6
15 24 25 20 7
14 23 22 21 8
13 12 11 10 9
6.LinkedList를 는 를 만들, 를 linkedlist를 만들봅.
#include <stdio.h> struct node{ int data; struct node *next; }; int main() { struct node *list=(struct node*)malloc(sizeof(struct node)); return 0; }
7.동 list 몇 는 를 만들봅. list->next->next = 동;
#include <stdio.h> struct node{ int data; struct node *next; }; int main() { struct node *list=(struct node*)malloc(sizeof(struct node)); list->next=(struct node*)malloc(sizeof(struct node)); list->next->next=(struct node*)malloc(sizeof(struct node)); return 0; }
8.LinkedList를 만들, 리 data 4,5,3,7,12,24,2,9 들 봅.
1.6.1.2
1.Koistudy163
2.163번 문를 , 문를 떻 는 말봅.
2.163번 문를 , 문를 떻 는 말봅.
#include <stdio.h> int main() { int key; char code[100]; int i=0; scanf("%d",&key); scanf("%s",code); while(code[i]!='\0') { printf("%c",key+code[i]); i++; } return 0; }
3.문 대 Palindrome, Not Palindrome 는 램 봅.
level, racecar, deed는 palindrome, sadfds는 not Palindrome
level, racecar, deed는 palindrome, sadfds는 not Palindrome
#include <stdio.h> #include <string.h> // strlen() int main() { char arr[100]; int i=0; int len; scanf("%s",arr); len=strlen(arr); ///문 for(i=0;i<len;i++) { if(arr[i]!=arr[len-i-1]) { printf("Not Palindrome\n"); return 0;; } } printf("Palindrome\n"); return 0; }