top of page

소스 코드 제출

공개·회원 77명

20250805

/*

#include <stdio.h>


typedef struct

{

char name[11];

int score;

} student;


int main()

{

student arr[100];

int n, m;

scanf("%d %d", &n, &m);


for (int i = 0; i < n; i++)

{

scanf("%s %d", arr[i].name, &arr[i].score);

}


student tmp;

for(int i = 0; i < n; i++)

{

for(int j = 0; j < n; j++)

{

if (arr[j].score < arr[j+1].score)

{

tmp = arr[j];

arr[j] = arr[j+1];

arr[j+1] = tmp;

}

}

}


for (int i = 0; i < m; i++)

{

printf("%s\n", arr[i].name);

}


return 0;

}

*/

/*

#include <stdio.h>


typedef struct

{

int country, student, score;

}students;


int main()

{

students arr[200];

int n;

scanf("%d",&n);


for(int i=1;i<=n;i++)

{

scanf("%d %d %d", &arr[i].country, &arr[i].student, &arr[i].score);

}


students tmp;

for(int i=1;i<=n;i++)

{

for(int j=1;j<=n;j++)

{

if(arr[j].score<arr[j+1].score)

{

tmp=arr[j];

arr[j]=arr[j+1];

arr[j+1]=tmp;

}

}

}


if(arr[1].country==arr[2].country)

{

arr[3]=arr[4];

}


for(int i=1;i<=3;i++)

{

printf("%d %d\n", arr[i].country, arr[i].student);

}


return 0;

}


스택, 큐



Stack (엘리베이터)

1. 쌓는거

2. 나중에들어온게 먼저 나가는거

3. 후입선출 Last In First Out (LIFO)


Queue (에스컬레이터)

2. 먼저 들어온게 먼저 나가는거

3. 선입선출 First In First Out (FIFO)


*/

/*

#include <stdio.h>

int stack[500]={};

int top = -1; // 마지막데이터의위치


void view()

{

printf("stack [ ");

for(int i=0;i<=top;i++)

{

printf("%d ",stack[i]);

}

printf("] top = %d \n",top);

}


void push(int data)

{

top++;

stack[top] = data;

}


int rpop()

{

if(top>-1)

{

top--;

}

return stack[top+1];

}


int main()

{

push(5);

view();

push(100);

view();

push(50);

view();


while( top != -1 )

printf("pop data is %d\n",rpop());

}



*/

/*

#include <stdio.h>

int stack[1000] = {};

int top = -1;


void push(int a)

{

top++;

stack[top]=a;

}


int pop()

{

if(top>-1)

{

top--;

}

return stack[top+1];

}


int main()

{

int n,x;

scanf("%d", &n);

for(int i=0; i<n; i++)

{

scanf("%d", &x);

push(x);

}


while(top!=-1)

printf("%d ", pop());


return 0;

}

*/

//천단위 구분기호

#include <stdio.h>

char stack[200]={};

int top=-1;


int main()

{

int n;

scanf("%d",&n);

char num[200]={};

scanf("%s",num);

}

8회 조회
주소 : 경기도 용인시 광교중앙로 302 블루 스퀘어 602호
연락처 : 031) 216 - 1546 ,     031) 215 - 1546
사업자등록번호 : 465-92-00916
​학원 등록 제 4603호
bottom of page