1050 - Ars Longa

You have been struck with inspiration, and are designing a beautiful new art sculpture for the foyer of your local museum. For highly important artistic reasons, you are designing it using very specific materials. However, you are not sure if physics is on your side. Will your sculpture actually stand up?

The sculpture will be composed of various ball joints weighing 1 kilogram each, and various rods (of negligible weight) connecting the joints. Rods cannot be stretched or compressed, and they can never detach from a joint. However, they are free to rotate around the joints in any direction. The joints that lie on the ground are glued in place; all others are free to move. For simplicity, you may ignore the effects of intersections of rods; each rod exerts force only on the 2 joints connected to it. Also, any joint that is in the air will have at least one rod coming out that is not parallel to the ground. This prevents the degenerate case where a ball is supported only horizontally by a rigid structure. In real life, it would sag just a little.

Write a program to determine whether your structure is static (that is, will not immediately move from the effects of gravity). Note that each rod can transmit an arbitrarily large tensional force along its length, and that ``being static" means that the tensional forces at each joint balance the weight of the joint.

If the structure is static, you must also determine whether it is stable (that is, will not move if perturbed slightly by pulling its joints).

Input 

The input contains several sculpture descriptions. Every description begins with a line containing integersJ and R, the number of joints and rods in the structure, respectively. Joints are numbered from 1 to J. The description continues with J lines, one per joint, each containing 3 floating point numbers giving the xy,z coordinates of that joint. Following are R lines, one per rod, with 2 distinct integers indicating the joints connected by that rod.

Each rod is exactly the right length to connect its joints. The z coordinates will always be non-negative; az coordinate of 0 indicates that the joint is on the ground and fixed in place. There are at most 100 joints and 100 rods.

The last description is followed by a line containing two zeroes.

Output 

For each sculpture description, output `NON-STATIC', `UNSTABLE', or `STABLE', as shown in the sample output.

Sample Input 

4 3 
0 0 0 
-1.0 -0.5 1.0 
1.0 -0.5 1.0 
0 1.0 1.0 
1 2 
1 3 
1 4 
4 6 
0 0 0 
-1.0 -0.5 1.0 
1.0 -0.5 1.0 
0 1.0 1.0 
1 2 
1 3 
1 4 
2 3 
2 4 
3 4 
7 9 
0 0 0 
-1.0 -0.5 1.0 
1.0 -0.5 1.0 
0 1.0 1.0 
-1.0 -0.5 0 
1.0 0.5 0 
0 1.0 0 
1 2 
1 3 
1 4 
2 3 
2 4 
3 4 
2 5 
3 6 
4 7 
0 0

Sample Output 

Sculpture 1: NON-STATIC 
Sculpture 2: UNSTABLE 
Sculpture 3: STABLE

Claimer: The data used in this problem is unofficial data prepared by Derek Kisman. So any mistake here does not imply mistake in the offcial judge data. Only Derek Kisman is responsible for the mistakes. Report mistakes to dkisman@acm.org






#include<stdio.h>
#include<string.h>
#include<stdlib.h>
#include<math.h>
double x[101],y[101],z[101],a[300][101],b[300][101],eps,c;
int n,m,r,i,j,k,l,t;

bool ok()
{
	l=0;
	for(i=m;i;i--)
	{
		k=l;
		for(j=l+1;j<r;j++)
			if(fabs(b[j][i])>fabs(b[k][i]))
				k=j;
		if(fabs(b[k][i])<eps)
			continue;
		memcpy(x,b[l],sizeof(x));
		memcpy(b[l],b[k],sizeof(x));
		memcpy(b[k],x,sizeof(x));
		for(j=l+1;j<r;j++)
		{
			c=b[j][i]/b[l][i];
			for(k=0;k<i;k++)
				b[j][k]-=c*b[l][k];
			b[j][i]=0;
		}
		l++;
	}
	for(i=l;i<r;i++)
		if(fabs(b[i][0])>eps)
			return false;
	return true;
}

int main()
{
	eps=0.1;
	while(scanf("%d%d",&n,&m)&&n)
	{
		memset(a,0,sizeof(a));
		for(i=0;i<n;i++)
			scanf("%lf%lf%lf",&x[i],&y[i],&z[i]);
		for(i=1;i<=m;i++)
		{
			scanf("%d%d",&j,&k);
			j--,k--;
			if(z[j])
			{
				a[3*j][i]=x[k]-x[j];
				a[3*j+1][i]=y[k]-y[j];
				a[3*j+2][i]=z[k]-z[j];
			}
			if(z[k])
			{
				a[3*k][i]=x[j]-x[k];
				a[3*k+1][i]=y[j]-y[k];
				a[3*k+2][i]=z[j]-z[k];
			}
		}
		r=0;
		for(i=0;i<n;i++)
			if(z[i]>0)
			{
				memcpy(b[r++],a[i*3],sizeof(x));
				memcpy(b[r++],a[i*3+1],sizeof(y));
				memcpy(b[r++],a[i*3+2],sizeof(z));
				b[r-1][0]=1;
			}
		printf("Sculpture %d: ",++t);
		if(!ok())
		{
			puts("NON-STATIC");
			continue;
		}
		r=0;
		for(i=0;i<n;i++)
			if(z[i]>0)
			{
				memcpy(b[r++],a[i*3],sizeof(x));
				memcpy(b[r++],a[i*3+1],sizeof(y));
				memcpy(b[r++],a[i*3+2],sizeof(z));
				b[r-1][0]=sin(double(i*3+1));
				b[r-2][0]=sin(double(i*3+2));
				b[r-3][0]=sin(double(i*3+3));
			}
		if(!ok())
		{
			puts("UNSTABLE");
			continue;
		}
		puts("STABLE");
	}
	return 0;
}


  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
### 回答1: ARS 480-21:数模实际上是一种用于数学建模和仿真的工具和技术。 数模是将现实世界的系统或问题转化为数学模型的过程。它可以帮助我们理解和分析复杂的系统,以及预测其未来的行为。数模可以应用于各个领域,包括物理、工程、经济、生物学等等。 ARS 480-21是指使用数模工具和技术进行建模和仿真的方法和原则。它可能包括选择适当的数学模型和算法,收集和处理相关数据,进行模型参数的估计和验算,以及进行模型的仿真和分析。 使用数模可以帮助我们更好地理解问题的本质,发现问题的规律和变量之间的关系。通过对模型的仿真和分析,我们可以测试不同的假设和方案,并评估它们的效果和可行性。 ARS 480-21数模的应用非常广泛。例如,在物理学中,数模可以用于预测材料的强度和性能,优化光学系统的设计等。在经济学中,数模可以用于分析市场的供求关系,预测经济增长趋势等。在生物学中,数模可以用于研究生物系统的动态行为,预测种群的生长和变化等。 总之,ARS 480-21数模是一种重要的方法和工具,可以帮助我们理解和解决实际问题。通过数学建模和仿真,我们可以更准确地预测和评估问题,以及制定相应的决策和措施。 ### 回答2: ARS 480-21 数模是一种特定的数模转换装置,可以将模拟信号转换为数字信号。具体地说,ARS 480-21 数模是指某个特定型号的数模转换器。在电子领域中,数模转换器负责将连续的模拟信号转换为离散的数字信号。这种转换通常发生在数据采集、信号处理和通信系统中。数模转换器在各种应用中都扮演着重要的角色。 数模转换器以不同的方式进行操作,但其基本原理是测量模拟信号的电压或电流,并将其转换为数字形式的离散数值。ARS 480-21 数模转换器可能采用一种特定的技术或方法,以实现高性能和精确度。通常,数模转换器具有一个输入范围,在这个范围内的模拟信号将被转换为相应的数字数据。 ARS 480-21 数模转换器在许多领域中得到广泛应用,如音频和视频处理、仪器测量、自动化系统以及通信系统等。在音频领域中,数模转换器被用来将模拟音频信号转换为数字音频信号,以便进一步处理和存储。在通信系统中,数模转换器常用于将模拟信号转换为数字信号,以便在数字通信中传输和处理。 综上所述,ARS 480-21 数模转换器是一种用于将模拟信号转换为数字信号的特定设备。它在许多应用中具有重要作用,实现了高精度和高性能的信号转换。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值