Toggle menu
Toggle personal menu
Not logged in
Your IP address will be publicly visible if you make any edits.

큰수찾아저장하기/김영록: Difference between revisions

From ZeroWiki
imported>Unknown
No edit summary
 
(Repair batch-0007 pages from live compare)
 
Line 4: Line 4:
=== 코드 ===
=== 코드 ===
  #include <stdio.h>
  #include <stdio.h>
  static int space[4][4];
  static int space[4][4];
  int width_sort(int a);
  int width_sort(int a);
  int height_sort(int a);
  int height_sort(int a);
Line 15: Line 15:
  for (i=0;i<3;i++){
  for (i=0;i<3;i++){
  for (j=0;j<3;j++){
  for (j=0;j<3;j++){
  printf("input[%d][%d] = ",i,j);
  printf("input[%d][%d] = ",i,j);
  scanf("%d",&space[i][j]);
  scanf("%d",&space[i][j]);
  }
  }
  }
  }
   
   
  for (i=0;i<3;i++){
  for (i=0;i<3;i++){
  space[i][3] = width_sort(i);
  space[i][3] = width_sort(i);
  space[3][i] = height_sort(i);
  space[3][i] = height_sort(i);
  }
  }
  space[3][3] = all_sort();
  space[3][3] = all_sort();
   
   
  // 출력
  // 출력
Line 37: Line 37:
  int max=0,i;
  int max=0,i;
  for (i=0;i<3;i++){
  for (i=0;i<3;i++){
  if (max < space[a][i]){
  if (max < space[a][i]){
  max = space[a][i];
  max = space[a][i];
  }
  }
  }
  }
Line 47: Line 47:
  int max=0,i;
  int max=0,i;
  for (i=0;i<3;i++){
  for (i=0;i<3;i++){
  if (max < space[a][i]){
  if (max < space[a][i]){
  max = space[a][i];
  max = space[a][i];
  }
  }
  }
  }
Line 58: Line 58:
  for (i=0;i<3;i++){
  for (i=0;i<3;i++){
  for (j=0;j<3;j++){
  for (j=0;j<3;j++){
  if (max < space[i][j]){
  if (max < space[i][j]){
  max = space[i][j];
  max = space[i][j];
  }
  }
  }
  }
Line 72: Line 72:
  printf("\n");
  printf("\n");
  for (j=0;j<4;j++){
  for (j=0;j<4;j++){
  printf("%d ",space[i][j]);
  printf("%d ",space[i][j]);
  }
  }
 
 
Line 79: Line 79:
  }
  }
=== 스크린샷 ===
=== 스크린샷 ===
[[:File:스샷1.JPG|스샷1.JPG]]
스샷1.JPG
=== 나한테 할말 ===
=== 나한테 할말 ===
남은 [[LittleAOI]]가 많다.-,.-;;
남은 [[LittleAOI]]가 많다.-,.-;;
Line 85: Line 85:
----
----
[[큰수찾아저장하기]] [[LittleAOI]]
[[큰수찾아저장하기]] [[LittleAOI]]

Latest revision as of 01:32, 27 March 2026

소감

최대값찾는 소트는 많이 해보아서 그리어렵지 않았다. 정렬소트를 연습해보고 싶다.

코드

#include <stdio.h>
static int space[4][4];
int width_sort(int a);
int height_sort(int a);
int all_sort();
void output();
void main()
{

int i,j;
for (i=0;i<3;i++){
	for (j=0;j<3;j++){
		printf("input[%d][%d] = ",i,j);
		scanf("%d",&space[i][j]);
	}
}

for (i=0;i<3;i++){
space[i][3] = width_sort(i);
space[3][i] = height_sort(i);
}
space[3][3] = all_sort();

// 출력
output();




}
///////////////////////////////////////////////
int width_sort(int a){
int max=0,i;
for (i=0;i<3;i++){
	if (max < space[a][i]){
		max = space[a][i];
	}
}
return max;
}
//////////////////////////////////////////////
int height_sort(int a){
int max=0,i;
for (i=0;i<3;i++){
	if (max < space[a][i]){
		max = space[a][i];
	}
}
return max;
}
/////////////////////////////////////////////
int all_sort(){
int max=0,i,j;
for (i=0;i<3;i++){
	for (j=0;j<3;j++){
		if (max < space[i][j]){
			max = space[i][j];
		}
	}
}
return max;
}
////////////////////////////////////////////
void output()
{
int i,j;
for (i=0;i<4;i++){
	printf("\n");
	for (j=0;j<4;j++){
		printf("%d ",space[i][j]);
	}
	
}

}

스크린샷

스샷1.JPG

나한테 할말

남은 LittleAOI가 많다.-,.-;;


큰수찾아저장하기 LittleAOI