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

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題解

<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>
            欧美一区二区三区久久精品| 欧美二区视频| 久久综合网络一区二区| 麻豆国产精品va在线观看不卡| 国产亚洲免费的视频看| 亚洲高清在线视频| 亚洲欧美乱综合| 欧美成人免费在线观看| av成人免费在线观看| 欧美在线观看视频在线| 欧美日韩三级在线| 激情五月婷婷综合| 亚洲色图在线视频| 开心色5月久久精品| 一本色道久久综合亚洲精品不卡| 韩国成人精品a∨在线观看| 99精品久久| 欧美成人精品在线观看| 一区二区三区毛片| 欧美黄色影院| 亚洲国产成人精品久久久国产成人一区 | 99综合在线| 性色av一区二区三区在线观看| 亚洲女与黑人做爰| 亚洲精品久久久久| 亚洲欧美日韩国产另类专区| 欧美1区视频| 激情综合色丁香一区二区| 亚洲欧美资源在线| 在线一区亚洲| 欧美日韩在线第一页| 亚洲区在线播放| 欧美成人有码| 久久亚洲综合| 在线播放亚洲一区| 久久中文精品| 久久久久久久一区二区| 激情自拍一区| 美女精品国产| 久久国产一区| 怡红院精品视频在线观看极品| 亚洲电影在线| 久久中文字幕导航| 久久se精品一区二区| 国产亚洲精品7777| 久久亚洲私人国产精品va| 欧美怡红院视频| 激情视频一区| 亚洲国产精品成人精品| 免费在线看成人av| 亚洲免费大片| 亚洲午夜电影| 国产视频在线一区二区| 久久视频这里只有精品| 久久亚洲精品网站| 亚洲人成网站影音先锋播放| 亚洲精品美女免费| 欧美日韩综合视频| 久久gogo国模啪啪人体图| 久久se精品一区二区| 亚洲激情第一区| 亚洲精品美女在线| 国产精品日本一区二区| 久久综合电影一区| 欧美jizz19hd性欧美| 亚洲综合国产| 久久精品国产一区二区三区| 亚洲七七久久综合桃花剧情介绍| 久久精品日韩| 欧美国产日韩免费| 午夜视频在线观看一区二区| 久久久精彩视频| 亚洲人成在线观看| 亚洲视频中文| 一区二区三区在线免费播放| 欧美韩日高清| 欧美精品在线看| 亚洲欧美一区二区三区极速播放| 久久黄色级2电影| 亚洲影视中文字幕| 国产精品美女久久久免费| 亚洲欧美激情一区| 欧美在线免费看| 国产午夜精品全部视频在线播放| 亚洲国产欧美日韩精品| 亚洲三级影片| 国产精品超碰97尤物18| 快射av在线播放一区| 久久婷婷久久| 亚洲视频综合在线| 午夜伦理片一区| 亚洲国产一区视频| 亚洲欧美区自拍先锋| 在线观看日韩av| 欧美第一黄网免费网站| 国产精品草草| 蘑菇福利视频一区播放| 欧美国产日韩一二三区| 亚洲视频axxx| 久久精品72免费观看| 国产亚洲精品成人av久久ww| 亚洲高清av| 欧美日韩精品免费| 久久精品二区三区| 欧美精品精品一区| 亚洲欧美日韩国产成人精品影院| 亚洲电影免费在线观看| 国产精品v日韩精品v欧美精品网站| 亚洲乱码日产精品bd| 亚洲综合首页| 99av国产精品欲麻豆| 午夜一区二区三区不卡视频| 日韩视频一区二区三区在线播放免费观看| 亚洲一区二区三区精品视频| 性色av一区二区三区红粉影视| 欧美体内she精视频| 亚洲自拍偷拍福利| 欧美专区在线| 亚洲调教视频在线观看| 嫩草国产精品入口| 鲁大师影院一区二区三区| 欧美日韩一区二区欧美激情| 亚洲国产精品悠悠久久琪琪| 韩日欧美一区二区| 欧美一区二区三区在线观看| 亚洲男女自偷自拍图片另类| 欧美日韩国产免费观看| 免费看成人av| 亚洲国产欧美一区二区三区同亚洲 | 久久久久五月天| 国产欧美日韩高清| 久久精品夜色噜噜亚洲a∨| 蜜臀91精品一区二区三区| 亚洲成人在线| 欧美精品一区在线观看| 一本一道久久综合狠狠老精东影业| 国产一区二区精品久久99| 久久精品青青大伊人av| 久久五月天婷婷| 国产精品视区| 亚洲女同同性videoxma| 欧美伊久线香蕉线新在线| 欧美精品三区| av成人激情| 欧美一区二区黄色| 国产日韩欧美日韩| 亚洲一区二区三区777| 午夜精品一区二区三区在线播放| 久久激情五月激情| 亚洲高清不卡在线| 亚洲韩国精品一区| 欧美三级在线视频| 一本一本久久a久久精品综合妖精| 欧美韩国在线| 99精品视频网| 久久中文在线| 亚洲精品字幕| 国产午夜精品视频| 久久国产一区二区| 欧美777四色影视在线| 在线精品一区| 蜜桃伊人久久| 久久午夜电影网| 亚洲国产日韩综合一区| 欧美精品国产一区| 99亚洲视频| 久久嫩草精品久久久精品一| 亚洲激情视频在线播放| 国产精品成人一区| 久久久精品国产一区二区三区| 亚洲一区二区在线免费观看视频 | 亚洲黄色影院| 午夜精品久久久| 国产精品爽爽ⅴa在线观看| 久久精品国产第一区二区三区最新章节 | 亚洲一区二区三区久久| 亚洲欧美国产高清va在线播| 国产精品久久久一区麻豆最新章节 | 欧美性猛片xxxx免费看久爱| 亚洲欧美日本伦理| 久久免费国产精品1| 一区二区三区精品视频在线观看| 免费在线国产精品| 性伦欧美刺激片在线观看| 亚洲激情综合| 久久综合久久综合久久| 亚洲欧美视频在线观看视频| 亚洲先锋成人| 亚洲一区亚洲| 亚洲天天影视| 亚洲欧美日韩电影| 午夜亚洲福利| 欧美亚洲免费在线| 亚洲欧美文学| 欧美与欧洲交xxxx免费观看| 亚洲主播在线播放| 亚洲欧美乱综合| 香蕉国产精品偷在线观看不卡| 国一区二区在线观看| 黄色成人精品网站|