포문 다돌렸는데 답이없으면
제대로 써봐 라고 나오게 하고싶은데 어케함 ?
#include <stdio.h>
#pragma warning(disable:4996)
int main(){
int count;
int hap;
int x = 1;
int y = 1;
int arr[10] = {0,};
while (1)
{
scanf("%d %d", &count, &hap);
if (count > 1000 || hap > 4000){
printf("INPUT ERROR!\n");
}
else if (count == 0 && hap == 0){
return 0;
}
else
{
for (x = 1; x <= hap/2; x++)
{
for (y = 1; y <= hap/2; y++)
{
if (4 * x + 2 * y == hap && x + y == count)
{
printf("%d %d\n", x, y);
}
}
}
}
}
}
해결
갯수->개수