U E D R , A S I H C RSS

Code Race/2014.8.20/Tumorer

진행사항


  • Phase 3에서 강제하차

Phase 1



  • 믿기 어렵겠지만 풀었습니다.
    • 배열로 받아서 순서에 따라 첫번째 수는 max에 넣고 두번째 수부터 max와 비교하여 max보다 크면 max에 대입
    • for문이 끝나면 max를 출력

Phase 2



  • 역시나 믿기 어렵겠지만 통과하였습니다.
    • 첫번째 수를 count로 받아 count를 for문에 대입
    • 숫자를 받아 1번과 마찬가지로 max 대입 비교. 마지막에 max를 출력

Phase 3


#include <stdio.h>
#include <Windows.h>
#include <ctype.h>
#include <stdlib.h>
#pragma warning(disable:4996)

int main(void)
{
	int count, a, max;
	char * arr[1000];
	int array[1000];
	FILE *f;
	f=fopen("2.txt","r");
	fscanf(f,"%d", &count);
	printf("%d\n", count);
	for(a=0; a<count; a++)
	{
		fscanf(f, "%c", &arr[a]);
		array[a] = atoi(arr[a]);
		if(a==0)
		{
			max=array[a];
		}
		else
		{
			if(array[a]>max)
			{
				max=array[a];
			}
			else
			{
				continue;
			}
		}
	}
	fclose(f);
	printf("%d", max);
	Sleep(5000);
	return 0;
}
  • arraya = atoi(arra); 부분에서 터지기 시작하며 마감
Valid XHTML 1.0! Valid CSS! powered by MoniWiki
last modified 2021-02-07 05:22:57
Processing time 0.0096 sec