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

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 極限定律 閱讀(1198) 評論(0)  編輯 收藏 引用 所屬分類: ACM-ICPC World Final 2008題解

<2009年4月>
2930311234
567891011
12131415161718
19202122232425
262728293012
3456789

導航

統計

常用鏈接

留言簿(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>
            欧美三级日本三级少妇99| 午夜精品偷拍| 欧美视频一区在线观看| 欧美一区三区二区在线观看| 亚洲激情电影中文字幕| 欧美粗暴jizz性欧美20| 亚洲一级片在线观看| 正在播放亚洲一区| 久久蜜桃精品| 久久久噜噜噜久噜久久| 午夜日本精品| 久久久久国产一区二区三区| 亚洲欧美激情视频| 亚洲午夜精品17c| 亚洲欧美日韩精品久久久久| 亚洲国产精品va在线看黑人动漫 | 亚洲欧洲日本mm| 91久久精品国产| 亚洲毛片av| 亚洲在线日韩| 欧美亚洲在线视频| 久久亚洲春色中文字幕| 巨胸喷奶水www久久久免费动漫| 久久久久国内| 欧美久久久久中文字幕| 欧美午夜不卡视频| 国产午夜精品久久| 日韩午夜中文字幕| 欧美一区二区三区免费观看视频| 欧美影视一区| 欧美.www| 午夜免费日韩视频| 欧美日韩国产免费| 伊人男人综合视频网| 久久一区视频| 国产精品久久午夜| 在线一区观看| 99精品久久| 久久精品伊人| 国产一区二区三区黄视频| 亚洲无线观看| 亚洲国产乱码最新视频| 久久麻豆一区二区| 国一区二区在线观看| 亚洲欧美一区二区精品久久久| 另类成人小视频在线| 亚洲免费观看视频| 欧美成人xxx| 日韩视频一区二区三区在线播放| 久久久水蜜桃av免费网站| 亚洲一区激情| 国产日韩欧美| 国产一区二区三区四区hd| 久久不射电影网| 亚洲精品久久7777| 免费日韩成人| 美女久久网站| 亚洲午夜免费视频| 午夜精品久久久久久久99水蜜桃 | 久久精品人人| 激情婷婷久久| 亚洲欧洲一级| 国产手机视频一区二区| 欧美~级网站不卡| 美女视频黄 久久| 欧美视频日韩| 亚洲国产清纯| 国产精品久久久久婷婷| 老**午夜毛片一区二区三区| 欧美日韩一区二区视频在线| 久久久99久久精品女同性| 欧美激情1区| 欧美在线视频一区二区三区| 欧美3dxxxxhd| 欧美成人四级电影| 国产欧美日韩综合一区在线播放 | 欧美日韩亚洲一区三区| 久久久国产一区二区| 欧美日韩在线一区二区| 欧美韩国在线| 亚洲黄一区二区三区| 久久精品国产免费看久久精品| 一区二区三区欧美日韩| 香蕉久久一区二区不卡无毒影院| 亚洲精品在线观看免费| 欧美高清视频免费观看| 国产欧美高清| 亚洲欧美日韩精品久久奇米色影视 | 亚洲欧美综合一区| 欧美色另类天堂2015| 亚洲人成网站精品片在线观看 | 欧美日韩一区二区三区| 亚洲人精品午夜| 欧美一区不卡| 国产欧美日韩专区发布| 欧美在线视频二区| 亚洲国产一区二区a毛片| 亚洲精品久久视频| 欧美激情亚洲另类| 夜夜嗨av一区二区三区四季av| 亚洲在线视频网站| 好吊色欧美一区二区三区四区| 久久久亚洲一区| 亚洲电影在线观看| 亚洲图片欧洲图片日韩av| 国产精品捆绑调教| 久久亚裔精品欧美| 欧美与欧洲交xxxx免费观看| 麻豆国产精品777777在线| 国产精品99久久久久久www| 国产麻豆综合| 国产精品xvideos88| 午夜精品亚洲| 亚洲精品色婷婷福利天堂| 午夜精品久久久久| 欧美一区二区三区四区视频| 永久免费毛片在线播放不卡| 亚洲大片一区二区三区| 久久五月激情| 老司机午夜精品视频| 久久激情一区| 久久xxxx精品视频| 亚洲一区二区在线免费观看视频 | 久热爱精品视频线路一| 亚洲欧美国产高清va在线播| 亚洲精品黄色| 免费观看久久久4p| 麻豆成人小视频| 欧美一区二区精品在线| 亚洲一区二区3| 中国成人黄色视屏| 一本色道久久综合亚洲精品高清| 欧美在现视频| 欧美中文字幕在线播放| 亚洲午夜在线观看| 亚洲一区二区视频在线观看| 亚洲在线观看免费| 亚洲在线一区二区| 亚洲少妇最新在线视频| 欧美一区二区三区日韩| 久久激情网站| 欧美精品性视频| 国产精品主播| 亚洲视频一区| 欧美成人有码| 在线一区日本视频| 欧美电影免费观看网站| 欧美日本精品一区二区三区| 亚洲精品一区在线观看| 亚洲欧美中文日韩在线| 免费日韩视频| 欧美日韩调教| 亚洲一区二区三区精品在线观看 | 好吊色欧美一区二区三区四区| 午夜性色一区二区三区免费视频| 在线不卡a资源高清| 亚洲一区在线播放| 亚洲欧美日本另类| 国产日韩精品一区观看 | 欧美性片在线观看| 中文无字幕一区二区三区| 午夜精品福利一区二区三区av| 国产精品羞羞答答| 亚洲欧美日韩国产综合| 久久激五月天综合精品| 国模 一区 二区 三区| 麻豆精品视频| 亚洲最快最全在线视频| 久久精品国产久精国产爱| 在线观看亚洲一区| 欧美欧美午夜aⅴ在线观看| 一区二区三区高清视频在线观看| 亚洲永久免费观看| 激情丁香综合| 久久蜜桃资源一区二区老牛| 亚洲第一网站| 亚洲欧美日本日韩| 国产亚洲精品福利| 欧美成在线视频| 性欧美xxxx视频在线观看| 久久嫩草精品久久久精品一| 亚洲精品国产拍免费91在线| 国产精品播放| 女人香蕉久久**毛片精品| 中文久久精品| 欧美sm视频| 中文在线资源观看网站视频免费不卡 | 国产精品色婷婷| 欧美大片第1页| 亚洲欧美激情精品一区二区| 欧美成人资源| 亚洲欧美视频| 99re6这里只有精品视频在线观看| 国产精品实拍| 欧美精品v日韩精品v韩国精品v | 欧美在线一区二区| 亚洲日本免费| 在线观看欧美一区| 国产欧美日韩综合精品二区| 欧美日韩免费观看中文|