U E D R , A S I H C RSS

Code Race/2014.8.20/한글의아름다움


PHASE 3
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#pragma warning (disable:4996)

int main() {
	char 입력버퍼[100];
	char *예외버퍼;//=(char *)malloc(sizeof(char)*100);
	int 입력=0;
	int 템프=0;
	int 아이;
	int 제이;
	int 개수=0;
	int 플래그=1;
	FILE* 파일;

	파일 = fopen("인풋.txt","r");

	fgets(입력버퍼,100,파일);

	개수=atoi(입력버퍼);

	if(개수==0)
		return -1;
//-------------------------------------------------------------//
		fgets(입력버퍼,100,파일);
		예외버퍼=strtok(입력버퍼," ");
		for(아이=0;*(예외버퍼+아이)!='\0';아이++)
		{
			if(예외버퍼[아이]<'0'||예외버퍼[아이]>'9')
			{
				플래그=0;
				break;
			}
			else
				플래그=1;
		}
			
		if(플래그==0)
		{

		}
		else
			템프=atoi(예외버퍼);
		
//-------------------------------------------------------------//

		for(아이=1;아이<개수;아이++)
		{
			예외버퍼=strtok(NULL," ");
			for(제이=0;예외버퍼[제이]!='\0';제이++)
			{
				if(예외버퍼[제이]<'0'||예외버퍼[제이]>'9')
				{
					플래그=0;
					break;
				}
				else
					플래그=1;
			}
			if(플래그==0)
				continue;
			else
				입력=atoi(예외버퍼);

			if(템프<입력)
				템프=입력;
		}
	
	printf("%d\n",템프);
	return 0;
}

PHASE 4
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#pragma warning (disable:4996)

int main() {
	int rowNum;
	int colNum;
	char inputTemp[100];
	char* exceptionBuffer;
	FILE* inputFile;
	int flag=1;

	int* rowMx;
	int* colMx;
	int temp=0;

	int i=0,j=0,k=0;

	inputFile=fopen("인풋.txt","r");

	fgets(inputTemp,100,inputFile);

	rowNum=atoi(strtok(inputTemp," "));
	colNum=atoi(strtok(NULL," "));

	if(rowNum==0||colNum==0)
		return -1;

	rowMx=(int*)malloc(rowNum*sizeof(int));
	colMx=(int*)malloc(colNum*sizeof(int));

//------------------------------------------//
	for(i=0;i<rowNum;i++) {
		fgets(inputTemp,100,inputFile);
		for(j=0;j<colNum;j++) {
			if(j==0)
				exceptionBuffer=strtok(inputTemp," ");
			else
				exceptionBuffer=strtok(NULL," ");

			for(k=0;*(exceptionBuffer+k)!='\0';k++) {
				if(exceptionBuffer[k]<'0'||exceptionBuffer[k]>'9')
				{
					flag=0;
					break;
				}
				else
					flag=1;
			}
			if(flag!=0) {
				temp=atoi(exceptionBuffer);

				if(rowMx[i]<temp)
					rowMx[i]=temp;
				if(colMx[i]<temp)
					colMx[i]=temp;
			}
		}
	}

	for(//출력//)

	return 0;
}
Valid XHTML 1.0! Valid CSS! powered by MoniWiki
last modified 2021-02-07 05:22:55
Processing time 0.0135 sec