More actions
imported>chj878194 No edit summary |
imported>chj878194 No edit summary |
||
| Line 63: | Line 63: | ||
{ | { | ||
int a[8], chk=0; | int a[8], chk = 0, chk2 = 0; | ||
int x1, x2, y1, y2; | int x1, x2, y1, y2; | ||
| Line 100: | Line 100: | ||
scanf(" %d %d %d %d %d %d %d %d", &reg[0], &reg[1], &reg[2], &reg[3], &mem[0], &mem[1], &mem[2], &mem[3]); | scanf(" %d %d %d %d %d %d %d %d", &reg[0], &reg[1], &reg[2], &reg[3], &mem[0], &mem[1], &mem[2], &mem[3]); | ||
while ( | |||
while (1) | |||
{ | { | ||
| Line 109: | Line 110: | ||
{ | { | ||
chk++; | chk++; | ||
} | |||
if (a[i] == 0) | |||
{ | |||
chk2++; | |||
} | } | ||
} | } | ||
| Line 116: | Line 121: | ||
} | } | ||
chk = 0; | chk = 0; | ||
if (chk2 == 4) | |||
load(x1, x2, y1, y2); | { | ||
load(x1, x2, y1, y2); | |||
} | |||
chk2 = 0; | |||
} | } | ||
printf("%d %d %d %d %d %d %d %d\n", reg[0], reg[1], reg[2], reg[3], mem[0], mem[1], mem[2], mem[3]); | printf("%d %d %d %d %d %d %d %d\n", reg[0], reg[1], reg[2], reg[3], mem[0], mem[1], mem[2], mem[3]); | ||
| Line 147: | Line 155: | ||
} | } | ||
} | } | ||
if (y1 == 0 && y2 == 1) | |||
{ | { | ||
if (x1 == 0 && x2 == 0) | if (x1 == 0 && x2 == 0) | ||
Revision as of 11:07, 20 May 2016
CodeRace 2016 답안 제출 포멧입니다.
강사: 최현준 새싹: 변영무, 김경찬
문제 1
#include<stdio.h>
void main()
{
printf("@@@@@@@@@@@@@@@@@@@@@@@@\n@ 초코하임반 @\n@ 멘토: 최현준 @\n@ 멘티: 김경찬, 변영무 @\n@@@@@@@@@@@@@@@@@@@@@@@@\n\n\n");
printf("Team: 최현준 김경찬 변영무\n");
}
문제 2
#include<stdio.h>
void main()
{
int a[8], chk=0;
printf("@@@@@@@@@@@@@@@@@@@@@@@@\n@ 초코하임반 @\n@ 멘토: 최현준 @\n@ 멘티: 김경찬, 변영무 @\n@@@@@@@@@@@@@@@@@@@@@@@@\n\n\n");
printf("Team: 최현준 김경찬 변영무\n");
while (4)
{
scanf(" %d %d %d %d %d %d %d %d", &a[0], &a[1], &a[2], &a[3], &a[4], &a[5], &a[6], &a[7]);
for (int i = 0; i < 4; i++)
{
if (a[i] == 1)
{
chk++;
}
}
if (chk == 4)
{
break;
}
chk = 0;
for (int i = 0; i < 8; i++)
{
printf("%d ", a[i]);
}
printf("\n");
}
}
문제 3
#include<stdio.h>
void load(int a, int b, int c, int d);
int reg[4];
short mem[4];
void main()
{
int a[8], chk = 0, chk2 = 0;
int x1, x2, y1, y2;
//1번
printf("Team: 최현준 김경찬 변영무\n");
/*
while (4)
{
scanf(" %d %d %d %d %d %d %d %d", &a[0], &a[1], &a[2], &a[3], &a[4], &a[5], &a[6], &a[7]);
for (int i = 0; i < 4; i++)
{
if (a[i] == 1)
{
chk++;
}
}
if (chk == 4)
{
break;
}
chk = 0;
for (int i = 0; i < 8; i++)
{
printf("%d ", a[i]);
}
printf("\n");
}*/
//3번
scanf(" %d %d %d %d %d %d %d %d", ®[0], ®[1], ®[2], ®[3], &mem[0], &mem[1], &mem[2], &mem[3]);
while (1)
{
scanf(" %d %d %d %d %d %d %d %d", &a[0], &a[1], &a[2], &a[3], &x1, &x2, &y1, &y2);
for (int i = 0; i < 4; i++)
{
if (a[i] == 1)
{
chk++;
}
if (a[i] == 0)
{
chk2++;
}
}
if (chk == 4)
{
break;
}
chk = 0;
if (chk2 == 4)
{
load(x1, x2, y1, y2);
}
chk2 = 0;
}
printf("%d %d %d %d %d %d %d %d\n", reg[0], reg[1], reg[2], reg[3], mem[0], mem[1], mem[2], mem[3]);
printf("\n");
}
void load(int x1, int x2, int y1, int y2)
{
for (int i = 0; i < 8; i++)
{
if (y1 == 0 && y2 == 0)
{
if (x1 == 0 && x2 == 0)
{
reg[0] = mem[0];
}
if (x1 == 0 && x2 == 1)
{
reg[0] = mem[1];
}
if (x1 == 1 && x2 == 0)
{
reg[0] = mem[2];
}
if (x1 == 1 && x2 == 1)
{
reg[0] = mem[3];
}
}
if (y1 == 0 && y2 == 1)
{
if (x1 == 0 && x2 == 0)
{
reg[1] = mem[0];
}
if (x1 == 0 && x2 == 1)
{
reg[1] = mem[1];
}
if (x1 == 1 && x2 == 0)
{
reg[1] = mem[2];
}
if (x1 == 1 && x2 == 1)
{
reg[1] = mem[3];
}
}
if (y1 == 1 && y2 == 0)
{
if (x1 == 0 && x2 == 0)
{
reg[2] = mem[0];
}
if (x1 == 0 && x2 == 1)
{
reg[2] = mem[1];
}
if (x1 == 1 && x2 == 0)
{
reg[2] = mem[2];
}
if (x1 == 1 && x2 == 1)
{
reg[2] = mem[3];
}
}
if (y1 == 1 && y2 == 1)
{
if (x1 == 0 && x2 == 0)
{
reg[3] = mem[0];
}
if (x1 == 0 && x2 == 1)
{
reg[3] = mem[1];
}
if (x1 == 1 && x2 == 0)
{
reg[3] = mem[2];
}
if (x1 == 1 && x2 == 1)
{
reg[3] = mem[3];
}
}
}
}
문제 4
여기에 코드를 넣어주세요
문제 5
여기에 코드를 넣어주세요
문제 6
여기에 코드를 넣어주세요