UVa11565 - Simple Equations

In this very first task, let us look at a boring mathematics problem. :-)

We have three different integers, x, y and z, which satisfy the following three relations:

  • x + y + z = A
  • xyz = B
  • x2 + y2 + z2 = C

You are asked to write a program that solves for x, y and z for given values of A, B and C.

For the Extreme version of this problem, please click here.

Input

The first line of the input file gives the number of test cases N (< 20). Each of the following N lines gives the values of A, B and C (1 ≤ A, B, C ≤ 10000).

Output

For each test case, output the corresponding values of x, y and z. If there are many possible answers, choose the one with the least value of x. If there is a tie, output the one with the least value of y. If there is no solution, output the line "No solution." instead.

Sample Input

2
1 2 3
6 6 14

Sample Output

No solution.
1 2 3

#include <cstdio>

using namespace std;

int a, b, c;

bool input();
void solve();


int main()
{
#ifndef ONLINE_JUDGE
	freopen("d:\\OJ\\uva_in.txt", "r", stdin);
#endif

	int n;
	scanf("%d", &n);
	
	while (n--) {
		input();
		solve();
	}

	return 0;
}

bool input()
{
	scanf("%d%d%d", &a, &b, &c);
	return true;
}


void solve()
{
	bool found = false;
	
	int x, 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");
	}
}




内容概要:本文档详细介绍了基于弹性架构搜索(Elastic Architecture Search, EAS)结合Transformer编码器进行多变量时间序列预测的项目实例。项目旨在自动化优化多变量时间序列预测模型结构,提升预测精度与鲁棒性,降低计算资源消耗,实现模型轻量化。通过MATLAB实现,项目采用Transformer编码器的多头自注意力机制,结合EAS的弹性权重共享和分阶段搜索策略,解决了高维多变量时间序列的复杂依赖建模、架构搜索计算资源需求高、模型过拟合、多步预测误差积累、数据异构性与缺失值处理、复杂模型训练收敛等挑战。最终,项目构建了一个高度模块化和可扩展的系统设计,适用于智能制造、能源管理、智慧交通等多个工业场景。 适合人群:具备一定编程基础,对时间序列预测、深度学习及MATLAB有一定了解的研发人员和研究人员。 使用场景及目标:①自动化优化多变量时间序列预测模型结构,提升预测精度与鲁棒性;②降低计算资源消耗,实现模型轻量化;③实现高度模块化与可扩展的系统设计,促进人工智能在工业领域的深度应用;④提供科研与教学的典范案例与工具,探索深度学习架构搜索在时序预测的前沿技术;⑤促进多变量时序数据融合与异质信息处理能力,推动MATLAB深度学习工具箱的应用与扩展。 其他说明:项目不仅聚焦于模型性能提升,更注重计算资源节约和应用落地的可行性。借助弹性架构搜索自动化调参,减少人工经验依赖,加快模型迭代速度,降低开发门槛。结合Transformer编码器的表达能力,显著改善多变量时间序列预测中的长期依赖捕捉和异质数据融合问题,为各类时间序列分析任务提供一种全新的解决方案。项目通过详细的代码实现和注释,帮助用户理解Transformer机制与弹性架构搜索如何协同工作,实现多变量时间序列预测。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

kgduu

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值