Series Determination

Series Determination


                                                                      题目描述
Boudreaux and Thibodeaux aren't very good at math, so they need you to write a program that can determine the second degree polynomial used to generate a given sequence of three integers. As proof that you've figured out the polynomial, they want your program to print out the next 3 integers in the sequence. 


You know that each sequence is generated by a polynomial of the form f(x) = Ax2 + Bx + C, where A, B, and C are integers in the range (-103 <= (A, B, C) <= 103). You are given the values f(0), f(1), f(2) and are to determine the values f(3), f(4), f(5). 


输入
Input to this problem will consist of a (non-empty) series of up to 100 data sets. Each data set will be formatted according to the following description, and there will be no blank lines separating data sets. 


Each data set consists of a single line containing the space-separated integer values of the polynomial evaluated at 0, 1, and 2 (in that order). These values will be in the range (-103 <= (f(0), f(1), f(2)) <= 103).


输出
For each data set, there will be exactly one line of output containing the space-separated integer values of the polynomial evaluated at 3, 4, and 5 (in that order). These values will be in the range (-105 <= (f(3), f(4), f(5)) <= 105).


样例输入
0 0 0
1 1 1
1 2 3
0 1 4
0 2 8
样例输出
0 0 0
1 1 1
4 5 6
9 16 25

18 32 50

#include<iostream>
using namespace std;
int main()
{
     int n;
     int a,b,c;
     while (cin>>a>>b>>c)
     {
         cout<<1*a-3*b+3*c<< " " ;
         cout<<3*a-8*b+6*c<< " " ;
         cout<<6*a-15*b+10*c;
         cout<<endl;
     }
}

此题读懂题意,即使根据f(0),f(1),f(2)值求得f(3)f(4)f(5)

可通过待定系数法得到每一个结果表达式,进行运算即可


  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值