暑假训练赛20160719

F--Hot or Cold?
Time Limit:3000MS     Memory Limit:0KB     64bit IO Format:%lld & %llu

Description

Download as PDF

John Smith, who is a member of Academy of Cold Manager (ACM), is in charge of a large-scale cold store. For him, it's a troublesome job. Whenever the temperature in the cold store is too hot or too cold for a long time, the goods will be damaged. And poor Mr. Smith will have to compensate for the loss of the store.

Therefore, Mr. Smith has installed an automatic temperature control system in the store. The system may control the temperature according to the input polynomial and the start time. At each moment, it tries to adjust the temperature equal to the value of the polynomial function. But Mr. Smith still feels worried. Since he could not know the effect beforehand how the system will regulate. At such a worrisome moment, it's lucky for him to call to remembrance that you, an excellent programmer, are willing to offer a program to help him. Making use of this program, he may simply input the polynomial and the parameters of the start time and the end time, and then he will be aware of the average temperature during this period. Now he is relieved from such a bothersome job.

Input

The input file may contain several data sets. Each data set begins with a line containing an integer n(n < 100), which specifies the highest power of the polynomial. A value of 0 for the power indicates the end of input, and this data set should not be processed. In each data set, the following line contains n + 1 real numbers, which tell the coefficients of the polynomial. The sequence of those coefficients is arranged according to the power of items from high to low in the polynomial. If an item of the polynomial does not exist, the corresponding coefficient is 0. And then follows a line consists of 2 real numbers s and e(s < e), indicating the start time and the end time.

Output

For each data set, compute t, the average temperature of the input polynomial from the start time to the end time. Print your answer as a single real number accurate to 3 decimal places on a line by itself. You should not print any more white spaces or blank lines in the output.

Sample Input

2 
1.0 0.0 0.0 
0.0 1.0 
0

Sample Output

0.333


数学积分--


代码:

#include<cstdio>
#include<cmath>
#include<cstring>
#include<iostream>
#include<algorithm>
using namespace std;
double xi[120],s,kai,jie;
int main()
{
	int n;
	while (scanf("%d",&n),n)
	{
		for (int i=n+1;i>0;i--)
		{
			scanf("%lf",&xi[i]);
			xi[i]/=i;
		}
		scanf("%lf%lf",&kai,&jie);
		s=0.0;
		for (int i=n+1;i>0;i--)
		s+=xi[i]*(pow(jie,i)-pow(kai,i));
		s/=(jie-kai);
		printf("%.3lf\n",s);
	}
	return 0;
}



I - Digital Rivers
Time Limit:3000MS     Memory Limit:0KB     64bit IO Format:%lld & %llu

Description

Download as PDF

A digital river is a sequence of numbers where the number following n is n plus the sum of its digits. For example, 12345 is followed by 12360, since 1 + 2 + 3 + 4 + 5 = 15. If the first number of a digital river is k we will call it river k.

For example, river 480 is the sequence beginning {480, 492, 507, 519,...} and river 483 is the sequence beginning {483, 498, 519,...}.

Normal streams and rivers can meet, and the same is true for digital rivers. This happens when two digital rivers share some of the same values. For example: river 480 meets river 483 at 519, meets river 507 at 507, and never meets river 481.

Every digital river will eventually meet river 1, river 3 or river 9. Write a program that can determine for a given integer n the value where river n first meets one of these three rivers.

Input

The input may contain multiple test cases. Each test case occupies a separate line and contains an integer n(1$ \le$n$ \le$16384). A test case wit h value of 0 for n terminates the input and this test case must not be processed.

Output

For each test case in the input first output the test case number (starting from 1) as shown in the sample output. Then on a separate line output the line ``first meets river x at y". Here y is the lowest value where river n first meets river x (x = 1 or 3 or 9). If river nmeets river x at y for more than one value of x, output the lowest value.

Print a blank line between two consecutive test cases.

Sample Input

86 
12345 
0

Sample Output

Case #1 
first meets river 1 at 101 

Case #2 
first meets river 3 at 12423



代码:

#include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;
#define MA 100000100
int he[MA];
int ji(int xx)
{
	int lp,jia;
	lp=xx;jia=0;
	while (xx)
	{
		jia+=xx%10;
		xx/=10;
	}
	lp+=jia;
	return lp;
}
int main()
{
	memset(he,0,sizeof(he));
	int shu;
	shu=9;
	while (shu<MA)
	{
		he[shu]=9;
		shu=ji(shu);
	}
	shu=3;
	while (shu<MA)
	{
		he[shu]=3;
		shu=ji(shu);
	}
	shu=1;
	while (shu<MA)
	{
		he[shu]=1;
		shu=ji(shu);
	}
	int n,lp=1;
	while (scanf("%d",&n),n)
	{
	    if (lp>1)
	    printf("\n");
		printf("Case #%d\n",lp++);
		while (n)
		{
			if (he[n])
			{
				printf("first meets river %d at %d\n",he[n],n);
				break;
			}
			n=ji(n);
			if (n>MA)
			{
				printf("%d   66",n);
				break;
			}
		}
	}
	return 0;
}




  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
DC竞轴承故障检测训练是一项重要的事,旨在提高参者在轴承故障检测方面的技能和能力。轴承是现代机械设备的核心部件之一,其正常运转对于设备的性能和寿命都有着重要影响。 该训练主要分为两个部分,理论知识考核和实践操作。理论知识考核部分包括轴承的工作原理、常见故障模式、检测方法等内容。参者需要通过笔试形式回答相关问题,以展示他们对轴承故障检测知识的掌握程度。 实践操作部分是该训练的重点,参者将接受现场模拟操作任务。他们需要使用各种专业仪器和设备,对已安装在测试设备上的轴承进行全面的检测和评估。参者需要准确识别和定位轴承的故障类型,例如磨损、松动、疲劳等,并给出相应的处理建议。 此外,比中还将强调团队合作和沟通交流的重要性。参者将分为小组,共同完成任务,并在限定的时间内做出准确的判断和决策。 DC竞轴承故障检测训练意义重大。通过这项训练,可以提高参者的专业知识水平和实践操作能力,培养他们在轴承故障检测领域的创新能力和解决问题的能力。同时,这项比还有利于推动轴承故障检测技术的发展和应用,提高设备运维的质量和效率。 总之,DC竞轴承故障检测训练是一个重要的平台,对于推动轴承故障检测技术的普及和发展具有积极作用,也为参者提供了一个锻炼自身技能的机会。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值