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

새싹교실/2017/C언어가르쳐조/5월30일: Difference between revisions

From ZeroWiki
No edit summary
No edit summary
Line 46: Line 46:
for (int sentinel = 0; sentinel < input; sentinel++)
for (int sentinel = 0; sentinel < input; sentinel++)
{
{
scanf("%d", &i&#91;sentinel&#93;);
scanf("%d", &i[[[sentinel]]]);
}
}
for (int sentinel = 0; sentinel < input; sentinel++)
for (int sentinel = 0; sentinel < input; sentinel++)
{
{
count_i&#91;sentinel&#93; = i[[input - sentinel - 1]];
count_i[[[sentinel]]] = i[[[input - sentinel - 1]]];
}
}


for (int sentinel = 0; sentinel < input; sentinel++)
for (int sentinel = 0; sentinel < input; sentinel++)
{
{
printf("%d ", count_i&#91;sentinel&#93;);
printf("%d ", count_i[[[sentinel]]]);
}
}
printf("\n");
printf("\n");

Revision as of 08:40, 30 May 2017

예정

  • 다음 주(6/6) : 현충일
    • 어쩔까요?
  • 다다음 주(6/13) : 시험대비 특강
  • 1학기 종료 후
    • 1안 : 여름방학때 한다.
    • 2안 : 2학기에 한다.
    • 3안 : 이대로 안녕한다.
  • 오늘은 실습날
  • #1 : 배열 뒤집기
    • 작성 후 위키에 올려주세요.
    • 입력 :
    • line 1 : 배열의 크기( 0 < N <= 1,000,000)
    • line 2 ~ N + 1 : 배열에 들어갈 값(자연수, < 1,000,000)
    • 출력 : line N + 1 ~ line 2의 값
    • tip :
    • N번보다 적게 볼 수도 있다.
    • (이 문제에서는)배열을 뒤집지 않아도 된다.
  • #2 : 정사각 행렬곱 함수 작성
    • N * N 행렬을 곱한 결과를 반환하는 함수 작성
    • int** matrix_mul(int **s, int **t, int N);
  • #3 : qsort 써보기
    • void qsort(void* base, size_t n, size_t size, int (*comp)(void*, void*); //<stdlib.h>에 있는 표준 함수
    • 입력 :
    • line 1 : 정렬 할 수의 개수 ( 0 < N <= 1,000,000)
    • line 2 ~ : 정렬 할 수 (양의 정수, < 1,000,000)
    • 출력 : 정렬 된 N개의 수
    • tip :
    • 좋은 정렬법을 아시면 직접 짜보세요!
    • 좋은 정렬법!

실습

  • 안재형
    • #1
  1. include <stdio.h>

int main(void) { int *i = (int *)malloc(sizeof(int) * 1000000); int *count_i = (int *)malloc(sizeof(int) * 1000000); int input;

scanf("%d", &input);

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

for (int sentinel = 0; sentinel < input; sentinel++) { count_i[[[sentinel]]] = i[[[input - sentinel - 1]]]; }

for (int sentinel = 0; sentinel < input; sentinel++) { printf("%d ", count_i[[[sentinel]]]); } printf("\n");

return 0; }

기타 / 후기 / 방명록


새싹교실/2017/C언어가르쳐조 새싹교실/2017