zoukankan      html  css  js  c++  java
  • 二次多项式求解

    描述

    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 (-104 <= (f(3), f(4), f(5)) <= 104).

    样例输入

    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 <stdio.h>
    
    
    int main()
    {
        int a,b,i,j,k,s,h,m;
        while(~scanf("%d %d %d",&i,&j,&k))
        {
            a=(k-2*j+i)/2;
            b=(4*j-k-3*i)/2;
            s=9*a+3*b+i;
            h=16*a+4*b+i;
            m=25*a+5*b+i;
            printf("%d %d %d
    ",s,h,m); 
        }
        return 0;
    }
  • 相关阅读:
    linux ---性能监控(工具)
    inux --- 服务器性能监控
    Jmeter——BeanShell PreProcessor的用法
    Jmete ----r默认报告优化
    jmeter --- 基于InfluxDB&Grafana的JMeter实时性能测试数据的监控和展示
    转Jmeter报告优化之New XSL stylesheet
    Jmeter----组件执行顺序与作用域
    Jmeter----属性和变量
    Jmeter----逻辑控制器(Logic Controller)
    Jmeter----HTTP Request Defaults
  • 原文地址:https://www.cnblogs.com/andrew3/p/12721914.html
Copyright © 2011-2022 走看看