구조체
/*
1452/// do while 사용
#include <stdio.h>
int a[100001];
int swap(int n, int i) {
int p;
p=a[n];
a[n]=a[i];
a[i]=p;
}
void quicksort(int s, int e) {
int pivot=s;
int low=pivot;
int high=e+1;
if(s>e) return ;
do
{
do {low++;} while(a[low]<a[pivot]);
do {high--;}while(a[high]>a[pivot]);
if(low<high) swap(low, high);
}while(low<high);
swap(pivot, high);
quicksort(s, high-1);
quicksort(high+1, e);
}
int main()
{
int n, i;
scanf("%d", &n);
for(i=1; i<=n; i++) {
scanf("%d", &a[i]);
}
quicksort(1, n);
for(i=1; i<=n; i++) {
printf("%d\n", a[i]);
}
return 0;
}
*/
/*
3004
#include <stdio.h>
int a[50001];
int b[50001];
int n, i, j, temp;
int bs(int s, int e, int k) {
int mid=(s+e)/2;
if(s>e) return 0;
if(a[mid]==k) return mid;
else if(a[mid]>k) bs(s,mid-1,k);
else bs(mid+1,e,k);
}
int swap(int t, int r) {
int p;
p=a[t];
a[t]=a[r];
a[r]=p;
}
void quicksort(int s, int e) {
int pivot=s;
int low=pivot;
int high=e+1;
if(s>e) return ;
do
{
do {low++;} while(a[low]<a[pivot]);
do {high--;}while(a[high]>a[pivot]);
if(low<high) swap(low, high);
}while(low<high);
swap(pivot, high);
quicksort(s, high-1);
quicksort(high+1, e);
}
int main() {
int k;
scanf("%d", &n);
for(i=1; i<=n; i++) {
scanf("%d", &a[i]);
b[i]=a[i];
}
quicksort(1,n);
for(i=1; i<=n; i++) {
printf("%d ", bs(1, n, b[i])-1);
}
return 0;
}
*/
/*
3014
#include <stdio.h>
int memo[100001]={};
int n;
int main() {
int i, k, j;
scanf("%d", &n);
for(i=1; i<=n; i++) {
scanf("%d", &k);
memo[k]++;
}
for(i=0; i<=100000;i++)
{
for(j=1;j<=memo[i];j++)
{
printf("%d ",i);
}
}
}
*/
/////////구조체///////
/*
#include <stdio.h>
typedef struct
{
int number;
char name[10];
double grade;
}student;
int main()
{
//int arr[50];
student st[100];
int i;
a.grade=3.5;
scanf("%d",&a.number);
scanf("%lf",&a.grade);
for(i=1;i<=3;i++)
{
scanf("%d %s %lf",&st[i].number, st[i].name, &st[i].grade);
}
}
*/
/*
4751
#include <stdio.h>
typedef struct {
int country;
int student;
int score;
}par;
int main() {
par a[101];
int i, n,j, temp, key;
int max=0,mi=1;
int memo[3]={};
scanf("%d\n", &n);
for(i=1; i<=n; i++) {
scanf("%d %d %d", &a[i].country,&a[i].student,&a[i].score);
}
for(i=1; i<=3; i++) {
max=0;mi=1;
if(i==3)
{
if(memo[1]==memo[2]) {
for(j=1;j<=n;j++)
{
if(a[j].country==memo[1])
{
a[j].score=0;
}
}
}
}
for(j=1;j<=n;j++)
{
if(max<a[j].score)
{
max=a[j].score;
mi=j;
}
}
printf("%d %d\n",a[mi].country, a[mi].student);
memo[i]=a[mi].country;
a[mi].score=0;
}
}
*/