U E D R , A S I H C RSS

CodeRace/2016/Mackerel (rev. 1.7)

Code Race/2016/Mackerel

강사: 최다인
새싹: 김상렬

문제 1

#define _CRT_SECURE_NO_WARNINGS
#include<stdio.h>



int main(void){
	

	printf("Mackerel:최다인, 김상렬");

	return 0;
}

문제 2


#define _CRT_SECURE_NO_WARNINGS
#include<stdio.h>



int main(void){

	int list[8];
	int i;
	int flag ;


	printf("Mackerel: 최다인, 김상렬 \n");

	while (1){

		flag = 1;
		for (i = 0; i < 8; i++){
			scanf("%d", &list[i]);

		}
		for (i = 0; i < 4; i++){
			if (list[i] == 0){
				flag = 0;
				break;
			}
		}
		if (flag == 1){
			break;
		}
		for (i = 0; i < 8; i++){
			printf("%d ", list[i]);
		}
		printf("\n");
		
	}




return 0;
}

문제 3


#define _CRT_SECURE_NO_WARNINGS
#include<stdio.h>

int reg[4];
int mem[4];
//int reg1, reg2, reg3, reg4;
//int mem1, mem2, mem3, mem4;

void load(int, int, int, int);

int main(void){

	int list[8];
	int i;
	int flag ;
	int loadflag;
	

	printf("Mackerel: 최다인, 김상렬 \n");
	for (i = 0; i < 4; i++){
		scanf("%d", &reg[i]);

	}
	for (i = 0; i < 4; i++){
		scanf("%d", &mem[i]);
			
	}


	
	while (1){

		flag = 1;
		loadflag = 1;


		for (i = 0; i < 8; i++){
			scanf("%d", &list[i]);

		}
		for (i = 0; i < 4; i++){
			if (list[i] == 0){
				flag = 0;
				break;
			}
		}
		if (flag == 1){
			break;
		}
		for (i = 0; i < 4; i++){
			if (list[i] == 1){
				loadflag = 0;
				break;

			}

		}
		if (loadflag == 1){
			load(list[4], list[5], list[6], list[7]);
		}

	}
	for (i = 0; i < 4; i++){
		printf("%d ", reg[i]);

	}
	for (i = 0; i < 4; i++){
		printf("%d ", mem[i]);
	}

	printf("\n");

	
	return 0;
}


void load(int x1, int x2, int x3, int x4){

	// 4, 5 : memmory  6, 7: register
	int memorynum, regnum;
	memorynum = x1 * 2 + x2;

	regnum = x3 * 2 + x4;
	reg[regnum] = mem[memorynum];
	
	

}

문제 4


문제 5


Valid XHTML 1.0! Valid CSS! powered by MoniWiki
last modified 2021-02-07 05:22:56
Processing time 0.0550 sec