/*
#include <stdlib.h>
int main()
{
printf("Hello world!\n");
return 0;
}
4891
#include <stdio.h>
int main()
{
int z,max=0,i,x,min=1000;
scanf("%d",&z);
for(i=1; i<=z; i++)
{
scanf("%d",&x);
if(min>x)
{
min=x;
}
if(max<x)
{
max=x;
}
}
printf("%d",max-min);
return 0;
}
4051
#include <stdio.h>
int main()
{
double s,e,m,x=0;
int i,h;
for(i=1; i<=5; i++)
{
scanf("%lf %lf",&s,&e);
m=e-s-1;
if(m<=0)
{
m=0;
}
if(m>=4)
{
m=4;
}
x=x+m;
}
if(15<=x)
{
h=10000*x-10000*x*5/100;
}
else if(5>=x)
{
h=10000*x+10000*x*5/100;
}
else
{
h=x*10000;
}
printf("%d",h);
return 0;
}
#include <stdio.h>
int main()
{
int s,s1,s2,s3,i;
scanf("%d %d %d\n%d",&s1,&s2,&s3,&s);
s3=s+s3;
if(s3>=60)
{
s2=s2+s3/60;
s3=s3%60;
}
if(s2>=60)
{
s1=s1+s2/60;
s2=s2%60;
}
if(s1>=24)
{
s1=s1%24;
}
printf("%d %d %d",s1,s2,s3);
return 0;
}
자료구조
1. 스택 + 2. 큐
3. 정렬
4. 탐색 (이진탐색)
5. Graph (DFS/BFS)
#include <stdio.h>
int stack[100]={};
int top = -1 ; // 맨위 데이터의 위치
void push(int n)
{
top++;
stack[top]=n;
view();
}
void pop() // stack에서 맨 위에 데이터 하나 빼세요
{
if(top==-1)
{
printf("stack is empty!!!!!!\n");
return ;
}
printf("pop data :%d\n",stack[top]);
top--;
view();
}
void view()
{
printf("stack : ");
for(int i=0;i<=top;i++)
{
printf("%d ",stack[i]);
}
printf("\n");
}
int main()
{
push (8);
push(5);
//top++;
//stack[top]=5;
push(2);
//top++;
//stack[top]=2;
// printf("%d\n",stack[top]);
pop();
pop();
pop();
pop();
//top--;
//printf("%d\n",stack[top]);
//top--;
//printf("%d\n",stack[top]);
return 0;
}
*/
#include <stdio.h>
int stack[1001]={};
int top=-1;
void push(int n)
{
top++;
stack[top]=n;
return ;
}
void pop()
{
if(top==-1)
{
return ;
}
printf("%d",stack[top]);
top--;
return ;
}
int main()
{
int n,m,c;
scanf("%d",&m);
for(int i=1; i<=m; i++)
{
scanf("%d",&n);
push(n);
}
for(int i=1; i<=n; i++)
{
c=c+n ;
}
return 0;
}