구현 코드:

 

 

#include <stdio.h>

#include <stdlib.h>

#include <string.h>

 

#define OUT_FILE_NAME "output.txt"

#define INPUT_FILE_NAME "input.txt"

 

void ReadInput(int *len, int *type);

void WriteOutput(char *text);

void RemoveOutput();

 

void ProcType1(int len);

void ProcType2(int len);

void ProcType3(int len);

 

 

int main()

{

          int len =0, type=0;

 

          void (*ProcTypeFn[4])(int);

          ProcTypeFn[1] = ProcType1;

          ProcTypeFn[2] = ProcType2;

          ProcTypeFn[3] = ProcType3;    

 

          RemoveOutput();

          ReadInput(&len, &type);

 

          ProcTypeFn[type](len);

         

          return 0;

}

 

void ProcType1(int len)

{

          //한변의 길이 len 정사각형을 아래와 같이 출력

          //1 1 1 1 1

          //2 2 2 2 2

          //3 3 3 3 3

          //4 4 4 4 4

          //5 5 5 5 5

          int i=0, j=0;

          char text[20] = {0};

          for(i=1;i<=len;i++)

          {

                    for(j=1;j<=len;j++)

                    {

                               sprintf(text, "%d ", i);

                               WriteOutput(text);

                    }

                    WriteOutput("\n");

          }

}

 

void ProcType2(int len)

{

          //한변의 길이 len 정사각형을 아래와 같이 출력

          //1 2 3 4 5

          //5 4 3 2 1

          //1 2 3 4 5

          //5 4 3 2 1

          //1 2 3 4 5

          int i=0, j=0;

          int direction = 1;

          char text[20] = {0};

          for(i=1;i<=len;i++)

          {

                    if(direction)

                    {

                               for(j=1;j<=len;j++)

                               {

                                         sprintf(text, "%d ", j);

                                         WriteOutput(text);

                               }

                    }

                    else

                    {

                               for(j=len;j>0;j--)

                               {

                                         sprintf(text, "%d ", j);

                                         WriteOutput(text);

                               }

                    }

                   

                    direction = direction==1 ? 0 : 1;

 

                    WriteOutput("\n");

          }

}

void ProcType3(int len)

{

          //한변의 길이 len 정사각형을 아래와 같이 출력

          //1 2 3 4 5

          //2 4 6 8 10

          //3 6 9 12 15

          //4 8 12 16 20

          //5 10 1 20 25

          int i=0, j=0;

          int num = 0;

          char text[20] = {0};

 

          for(i=1;i<=len;i++)

          {

                    num = i;

                    for(j=1;j<=len;j++)

                    {

                               sprintf(text, "%d ", num);

                               WriteOutput(text);

                               num = num + i;

                    }

                    WriteOutput("\n");

          }

}

 

void RemoveOutput()

{

          unlink(OUT_FILE_NAME);

}

 

void WriteOutput(char *text)

{

          FILE* fs;

          char *res=0;

          fs=fopen(OUT_FILE_NAME,"a");

          if(fs)

          {

                    while(*text != '\0')

                    {

                               fwrite(text, 1, 1, fs);

                               text++;

                    }

                   

                    fclose(fs);

          }

}

void ReadInput(int *len, int *type)

{

          FILE* fs;

          char data[100]={0};

          char *res=0;

          fs=fopen(INPUT_FILE_NAME,"r");

          if(fs)

          {

                    fread(data, sizeof(char),5,fs);

                    *len = atoi(strtok(data, " "));

                    *type = atoi(strtok(0, " "));

                    fclose(fs);

          }

}

 

모든 문제는 C/C++, Java, Python 를 사용할수 있습니다.

기초다지기만 표준 입출력방식을 사용하고, 그외 모든 문제는 파일입출력으로 하셔야 채점이 가능합니다.

입력파일은 "input.txt", 출력파일은 "output.txt"입니다.

 

 

 

 

구현한 코드 :

 

#include <stdio.h> #include <stdlib.h> #include <string.h> #define OUT_FILE_NAME "output.txt" #define INPUT_FILE_NAME "input.txt" void ReadInput(int *row, int *col); void WriteOutput(char *text); void RemoveOutput(); void Proc(int row, int col); int main() { int row =0, col=0; RemoveOutput(); ReadInput(&row, &col); Proc(row, col); return 0; } void RemoveOutput() { unlink(OUT_FILE_NAME); } void Proc(int row, int col) { int direction=1; int i=0,j=0; int num = 1; char text[20] = {0}; for(i=0;i<row;i++) { for(j=0;j<col;j++) { if(direction) sprintf(text, "%d ", num++); else sprintf(text, "%d ", num--); WriteOutput(text); } if(direction) num--; else num++; direction = direction == 0? 1:0; WriteOutput("\n"); num += col; } } void WriteOutput(char *text) { FILE* fs; char *res=0; fs=fopen(OUT_FILE_NAME,"a"); if(fs) { while(*text != '\0') { fwrite(text, 1, 1, fs); text++; } fclose(fs); } } void ReadInput(int *row, int *col) { FILE* fs; char data[100]={0}; char *res=0; fs=fopen(INPUT_FILE_NAME,"r"); if(fs) { fread(data, sizeof(char),5,fs); *row = atoi(strtok(data, " ")); *col = atoi(strtok(0, " ")); fclose(fs); } } 

 

 

 

순대곱창볶음이 땡기던 날이였는데

영등포엔 순대곱창볶음을 잘하는 곳이 없어서

고민하던 순간

 

시식으로 사장님께서

순대곱창볶음을 주시더라구요

신나2

 

 

먹어보고 바로 여기로

GoGo!!

 

들어가려다 보인

open event!!ㅋㅋㅋㅋㅋ

 

참이슬 + 처음처럼 = 3000원

하트3

 

 

 

돈막골의 메뉴판이에요

 

저희는 곱창볶음 2인분과

소주를 주문했어요 ㅋㅋ

 

 

 

곱창볶음과 순대볶음이

따로 메뉴가 되있고 합쳐진 메뉴는 없길래

물어보니 섞어 달라면

섞어주시다는...

 

다음엔 섞어서 먹어야겠어요 ㅋㅋㅋㅋㅋ

 

밑반찬은 미나리무침, 정체모를 나물, 깻잎

청양고추, 마늘, 쌈장

그리고 오이냉국이 나와요 ㅋㅋ

 

 

 

남자친구는 오이냉국을 안먹으니

2그릇다 내꺼!ㅋㅋ

 

 

 

 

곱창볶음을 주문하면 2~3분 후에

이렇게 짜잔하고 나와요 ㅋㅋㅋ

맛있겠쭁??

 

아쉬운건 깻잎이 아주 쪼금~ 들어가요

그래서 꼭 깻잎에 싸먹었어요

 

 

부드럽고 씹히는 맛이!

최고!!!!ㅋㅋㅋㅋ

 

곱창볶음엔 쏘주 한잔

하트3

 

아까 위에서 말한 이벤트로

참이슬 + 처음처럼을 먹었어용

 

 

 

마지막엔 항상 볶음밥으로 마므으리~~~

 

 

 

비교적 괜찮았던 식당이에용

영등포에서 곱창볶음 먹으러는 여기로 가야겠네요 ㅋㅋ

 

 

 

 

 

 

 

 

 

 

+ Recent posts