33 lines
558 B
C
33 lines
558 B
C
#include <math.h>
|
|
#include <stdio.h>
|
|
|
|
// Function prototypes
|
|
int checkf(float f);
|
|
|
|
int main(void) {
|
|
// Initialize variables
|
|
float m, n;
|
|
scanf("%f%f", &m, &n);
|
|
|
|
int a;
|
|
float bf, cf;
|
|
for (a = 0; a <= (int)m; a++) {
|
|
cf = (float)a + (n / 2) - (m * 2);
|
|
if (checkf(cf) == 1) {
|
|
bf = ((n / 2) - m - cf * 2);
|
|
if (checkf(bf) == 1) {
|
|
printf("%i %i %i\n", a, (int)bf, (int)cf);
|
|
}
|
|
}
|
|
}
|
|
return 0;
|
|
}
|
|
|
|
int checkf(float f) {
|
|
if (floorf(f) == f && f >= 0) {
|
|
return 1; // True
|
|
} else {
|
|
return 0; // False
|
|
}
|
|
}
|