UVa11565 - Simple Equations

简介: UVa11565 - Simple Equations
#include <cstdio>usingnamespacestd;
inta, b, c;
boolinput();
voidsolve();
intmain()
{
#ifndef ONLINE_JUDGEfreopen("d:\\OJ\\uva_in.txt", "r", stdin);
#endifintn;
scanf("%d", &n);
while (n--) {
input();
solve();
    }
return0;
}
boolinput()
{
scanf("%d%d%d", &a, &b, &c);
returntrue;
}
voidsolve()
{
boolfound=false;
intx, y, z;
for (x=-22; x<=22&&!found; x++) {
if (x*x<=c) {
for (y=-100; y<=100&&!found; y++) {
if (y!=x&&x*x+y*y<=c) {
for (z=-100; z<=100&&!found; z++)  {
if (z!=x&&z!=y&&x+y+z==a&&x*y*z==b&&x*x+y*y+z*z==c) {
printf("%d %d %d\n", x, y, z);
found=true;
                            }
                    }
                }
            }
        }
    }
if (!found) {
printf("No solution.\n");
    }
}
目录
相关文章
UVa11296 - Counting Solutions to an Integral Equation(枚举技巧)
UVa11296 - Counting Solutions to an Integral Equation(枚举技巧)
52 0
UVa389 - Basically Speaking
UVa389 - Basically Speaking
40 0
带你读《2022技术人的百宝黑皮书》——Ray Priors through Reprojection: Improving Neural Radiance Fields for Novel View Extrapolation(4)
带你读《2022技术人的百宝黑皮书》——Ray Priors through Reprojection: Improving Neural Radiance Fields for Novel View Extrapolation(4)
带你读《2022技术人的百宝黑皮书》——Ray Priors through Reprojection: Improving Neural Radiance Fields for Novel View Extrapolation(11)
带你读《2022技术人的百宝黑皮书》——Ray Priors through Reprojection: Improving Neural Radiance Fields for Novel View Extrapolation(11)
带你读《2022技术人的百宝黑皮书》——Ray Priors through Reprojection: Improving Neural Radiance Fields for Novel View Extrapolation(8)
带你读《2022技术人的百宝黑皮书》——Ray Priors through Reprojection: Improving Neural Radiance Fields for Novel View Extrapolation(8)
带你读《2022技术人的百宝黑皮书》——Ray Priors through Reprojection: Improving Neural Radiance Fields for Novel View Extrapolation(10)
带你读《2022技术人的百宝黑皮书》——Ray Priors through Reprojection: Improving Neural Radiance Fields for Novel View Extrapolation(10)
带你读《2022技术人的百宝黑皮书》——Ray Priors through Reprojection: Improving Neural Radiance Fields for Novel View Extrapolation(3)
带你读《2022技术人的百宝黑皮书》——Ray Priors through Reprojection: Improving Neural Radiance Fields for Novel View Extrapolation(3)
带你读《2022技术人的百宝黑皮书》——Ray Priors through Reprojection: Improving Neural Radiance Fields for Novel View Extrapolation(2)
带你读《2022技术人的百宝黑皮书》——Ray Priors through Reprojection: Improving Neural Radiance Fields for Novel View Extrapolation(2)
带你读《2022技术人的百宝黑皮书》——Ray Priors through Reprojection: Improving Neural Radiance Fields for Novel View Extrapolation(6)
带你读《2022技术人的百宝黑皮书》——Ray Priors through Reprojection: Improving Neural Radiance Fields for Novel View Extrapolation(6)
|
Java
HDU - 2018 Multi-University Training Contest 2 - 1004: Game
HDU - 2018 Multi-University Training Contest 2 - 1004: Game
106 0