青青草原综合久久大伊人导航_色综合久久天天综合_日日噜噜夜夜狠狠久久丁香五月_热久久这里只有精品

Problem G : Net Loss

Rose N. Blatt is designing an embedded neural network to place inside a cell phone. When trained by the phone’s
owner, the neural network will enable the user to dictate text messages in a hands-free way. The key idea in Rose’s
design is the use of complicated polynomial response functions in each of the nodes of the network (rather than the
more traditional thresholding functions used in many other neural nets). Figure 1 shows a portion of such a neural
network (the polynomials are not accurately graphed).
When Rose was ready to select her polynomials, she discovered a problem. Due to the limited amount of memory
available, she did not have enough space to store all of the coefficients of the polynomials in her network. She has
decided to use an approximation to each polynomial in the form of a continuous polygonal curve with two segments,
y = aB1Bx + aB0B and y = bB1Bx + bB0B. The segments meet at a point whose x-coordinate, c, is between -1 and +1. Rose wants
the approximation to be the best in the sense that the distance between p and the approximation function g is
minimal. We define the distance between p and g as the integral of the square of their difference:
For instance, if the polynomial is x^2-0.2, then the best polygonal approximation, with lines meeting at c = 0, is shown in Figure 2 (the dotted line shows the graph of the polygonal approximation).
In the few bytes that are available for each node, Rose can store the values of aB1B, aB0B, bB1B, bB0B, and c as signed numbers.
Fortunately Rose has a program that supplies her with a good guess for the value of c. Given this value, you are
asked to help Rose find the optimal values for aB1B, aB0B, bB1B, and bB0B in the approximations to her polynomials.

Input

The input file contains multiple test cases. Each test case consists of three lines. The first line contains a positive
integer n, 1 ≤ n ≤ 10, representing the degree of the polynomial p(x). This is followed by a line containing n +1
numbers between -1 and 1 inclusive, which are the coefficients of p(x) from highest order term down to the constant
term, expressed with at most three places after the decimal point. The last line for each test case contains the value
for c, -1 < c < 1, expressed with at most three places after the decimal point.

A line containing the integer zero follows the last test case.

Output

For each test case, print the case number (beginning with 1) and the four optimal values, displaying each with exactly
three places after the decimal point. The first and second values are the parameters a1 and a0 of the line segment
y = a1x + a0 defining g in the range -1 ≤ x ≤ c. The third and fourth values are the parameters b1 and b0 of the line
segment y = b1 + b0 defining g in the range c ≤ x ≤ 1. The distance d(p,g) between p and g (as defined earlier)
should be the minimum over all such choices for a1, a0, b1, and b0.

Sample Input

2
1.0 0.0 -0.2
0.0
3
1 0 -1 0
0.707
0

Output for the Sample Input

Case 1: -1.000 -0.367 1.000 -0.367
Case 2: -0.499 -0.036 1.198 -1.236

數學題,求函數g(x)里的常數項a0,a1,b0,b1,使得函數d(p,g)取得最值。
在推導出極值條件后,需要實現多項式求值,多項式乘法和多項式定積分3個函數,便能解決問題。

400027  2009-04-24 05:49:39 Accepted  0.002  Minimum  19193  C++  4124 - Net Loss
 1 #include <iostream>
 2 using namespace std;
 3 
 4 const int MAXPOW = 20;
 5 double a0,a1,b0,b1,A,B,C,D,E,F,G,H,I;
 6 struct poly{
 7     double c[MAXPOW];
 8     double value(double x) const{           //多項式求值
 9         double ans=0;
10         for(int i=MAXPOW-1;i>=0;i--)
11             ans=ans*x+c[i];
12         return ans;
13     }
14     poly operator * (const poly &p) const{  //多項式乘法
15         poly t;
16         for(int i=0;i<MAXPOW;i++)
17             for(int j=0;j<=i;j++)
18                 t.c[i]+=p.c[i-j]*c[j];
19         return t;
20     }
21     double integral(double a,double b) const{//定積分
22         poly t;
23         for(int i=1;i<MAXPOW;i++)
24             t.c[i]=c[i-1]/i;
25         return t.value(b)-t.value(a);
26     }
27     void clear(){
28         memset(c,0,sizeof(c));
29         }
30     poly(){
31         memset(c,0,sizeof(c));
32     }
33 }p,q;
34 int main(){
35     double c;
36     int i,n,ca=1;
37     while(scanf("%d",&n),n){
38         p.clear();
39         for(i=n;i>=0;i--) scanf("%lf",&p.c[i]);
40         scanf("%lf",&c);
41         q.c[1]=1,q.c[0]=-c;                 
42         A=p.integral(-1,c) , B=q.integral(-1,c) , C=(p*q).integral(-1,c) , D=(q*q).integral(-1,c);
43         E=p.integral(c,1) , F=q.integral(c,1) , G=(p*q).integral(c,1) , H=(q*q).integral(c,1);
44         I=2*(A+E-B*C/D-F*G/H);
45         a1=(C-I*B)/D , a0=I-c*a1 , b1=(G-I*F)/H , b0=I-c*b1;
46         printf("Case %d: %.3lf %.3lf %.3lf %.3lf\n",ca++,a1,a0,b1,b0);
47     }
48     return 0;
49 }

posted on 2009-04-24 14:05 極限定律 閱讀(1213) 評論(0)  編輯 收藏 引用 所屬分類: ACM-ICPC World Final 2008題解

<2025年12月>
30123456
78910111213
14151617181920
21222324252627
28293031123
45678910

導航

統計

常用鏈接

留言簿(10)

隨筆分類

隨筆檔案

友情鏈接

搜索

最新評論

閱讀排行榜

評論排行榜

青青草原综合久久大伊人导航_色综合久久天天综合_日日噜噜夜夜狠狠久久丁香五月_热久久这里只有精品
  • <ins id="pjuwb"></ins>
    <blockquote id="pjuwb"><pre id="pjuwb"></pre></blockquote>
    <noscript id="pjuwb"></noscript>
          <sup id="pjuwb"><pre id="pjuwb"></pre></sup>
            <dd id="pjuwb"></dd>
            <abbr id="pjuwb"></abbr>
            久久九九久精品国产免费直播| 欧美freesex8一10精品| 亚洲精品免费在线播放| 久久综合伊人77777蜜臀| 精品999日本| 欧美va天堂在线| 美女国产精品| 一卡二卡3卡四卡高清精品视频| 亚洲精品综合在线| 国产精品久久久久久影视| 小嫩嫩精品导航| 久久国产精品网站| 亚洲黄色在线观看| 亚洲精品资源| 国产一区二区高清不卡| 美女主播视频一区| 欧美人与禽性xxxxx杂性| 亚洲午夜久久久| 欧美在线视屏| 91久久精品www人人做人人爽 | 国产欧美一区在线| 久久免费视频这里只有精品| 欧美91精品| 亚洲综合精品四区| 久久精品毛片| 99在线精品观看| 欧美一级艳片视频免费观看| 亚洲大胆视频| 在线亚洲高清视频| 尤物yw午夜国产精品视频明星| 亚洲二区在线观看| 国产精品一区二区在线观看网站| 久久综合免费视频影院| 欧美精品久久一区| 久久精品亚洲精品国产欧美kt∨| 欧美成人一区二区在线| 小黄鸭视频精品导航| 欧美黄色aa电影| 久久人人爽人人爽爽久久| 欧美日产一区二区三区在线观看| 久久精品人人做人人爽| 欧美午夜在线| 亚洲大胆美女视频| 国产在线观看91精品一区| 亚洲精品国产精品国自产在线| 国产亚洲精久久久久久| 日韩一级精品| 亚洲精品美女在线| 欧美在线影院在线视频| 亚洲综合欧美| 欧美四级剧情无删版影片| 欧美激情成人在线| 精品51国产黑色丝袜高跟鞋| 一区二区三区日韩欧美| 99精品99久久久久久宅男| 久久亚洲综合| 裸体一区二区三区| 国产一区欧美| 性xx色xx综合久久久xx| 亚洲免费一级电影| 国产精品久久久久aaaa九色| 日韩视频一区二区三区| 亚洲精品视频啊美女在线直播| 久久综合给合| 欧美电影在线观看| 亚洲福利在线观看| 狼狼综合久久久久综合网 | 亚洲欧洲精品一区二区| 久久久亚洲精品一区二区三区| 欧美一区二区视频免费观看| 国产精品美女久久久久久免费| 一本久久知道综合久久| 亚洲综合丁香| 国产欧美精品在线| 久久国产精品久久w女人spa| 久久久国产亚洲精品| 国产亚洲欧洲| 久久久久久久91| 欧美freesex8一10精品| 亚洲精品免费看| 欧美日韩国产bt| 一区二区三区鲁丝不卡| 亚洲天堂av图片| 国产精品福利久久久| 亚洲一区国产精品| 久久成人人人人精品欧| 国产一区在线播放| 狼人社综合社区| 亚洲精品欧洲精品| 性欧美办公室18xxxxhd| 狠狠色狠狠色综合日日五| 久久躁狠狠躁夜夜爽| 亚洲精品美女| 欧美一区二区三区在线看| 激情国产一区二区| 欧美第一黄网免费网站| 在线一区亚洲| 久久精品二区三区| 亚洲精品欧美专区| 国产精品视频精品| 久久亚洲精品视频| 在线一区观看| 欧美国产精品久久| 午夜综合激情| 亚洲国产成人精品久久| 欧美先锋影音| 久久一区二区精品| 中文亚洲欧美| 欧美激情亚洲自拍| 欧美在线啊v| 一区二区免费看| 影音先锋亚洲视频| 国产精品v欧美精品v日本精品动漫 | 欧美一区二区成人| 亚洲欧洲午夜| 国内久久婷婷综合| 欧美日韩一区二区三区免费看 | 亚洲国产99| 欧美在线观看一区二区三区| 亚洲日本在线视频观看| 国内成+人亚洲+欧美+综合在线| 欧美日韩高清区| 两个人的视频www国产精品| 亚洲午夜视频| 91久久嫩草影院一区二区| 久久亚洲国产成人| 欧美伊人影院| 亚洲香蕉成视频在线观看| 亚洲精品四区| 亚洲国产精品999| 国产一区二区三区电影在线观看| 国产精品黄视频| 欧美日韩直播| 欧美日韩伦理在线| 欧美另类99xxxxx| 欧美高清在线一区| 欧美超级免费视 在线| 久久中文字幕一区| 久久免费视频在线| 久久视频国产精品免费视频在线| 欧美一区二区播放| 欧美一区二区三区免费在线看 | 麻豆成人在线播放| 久久天天躁狠狠躁夜夜爽蜜月| 欧美一区二区| 久久国产精品网站| 久久久一本精品99久久精品66| 性做久久久久久久免费看| 亚洲自拍偷拍麻豆| 欧美一区二区在线免费观看| 亚洲欧美日韩精品久久| 亚洲欧美成人精品| 欧美一级播放| 久久免费黄色| 欧美电影美腿模特1979在线看| 亚洲第一毛片| 亚洲欧洲在线播放| 99精品视频免费| 亚洲性感激情| 午夜精彩国产免费不卡不顿大片| 亚洲欧洲av一区二区| 久久久久高清| 欧美精品日韩综合在线| 欧美日韩一区自拍| 国产欧美一级| 在线免费观看日本一区| 亚洲免费高清| 先锋影音久久| 欧美福利在线| 一道本一区二区| 欧美一区视频| 欧美成人免费网站| 国产精品青草综合久久久久99 | 国产精品一区三区| 伊人成人在线| 一本一道久久综合狠狠老精东影业| 亚洲欧美日韩国产另类专区| 久久蜜桃精品| 亚洲久久一区二区| 午夜国产一区| 欧美黄网免费在线观看| 国产精品专区h在线观看| 亚洲第一精品福利| 亚洲影院色在线观看免费| 久久综合色播五月| 9人人澡人人爽人人精品| 久久久伊人欧美| 国产精品国产福利国产秒拍| 亚洲成人在线视频播放| 亚洲欧美在线aaa| 亚洲国产毛片完整版| 性欧美18~19sex高清播放| 欧美激情一二三区| 狠狠色狠狠色综合日日tαg| 宅男精品视频| 亚洲第一在线视频| 久久av一区二区三区漫画| 国产精品成av人在线视午夜片 | 欧美日韩在线播放一区二区| 伊人色综合久久天天五月婷|