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

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 極限定律 閱讀(1211) 評論(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| 亚洲精品在线看| 欧美激情中文字幕一区二区| 国产精品99久久久久久久女警| 欧美福利影院| 一区二区三区高清不卡| 亚洲国产日韩欧美在线99 | 欧美高清视频一区| 欧美xart系列在线观看| 亚洲黄色在线观看| 亚洲精品免费电影| 国产精品性做久久久久久| 欧美一区二区黄色| 久久久之久亚州精品露出| 亚洲国产精品久久久久| 亚洲激情一区二区| 国产精品女人久久久久久| 久久久久国产精品麻豆ai换脸| 欧美资源在线| 一区二区精品在线| 午夜宅男欧美| av不卡在线看| 久久福利一区| 一区二区三区回区在观看免费视频| 日韩亚洲一区二区| 狠狠综合久久| 亚洲视频导航| 91久久午夜| 性感少妇一区| 亚洲在线视频网站| 免费观看在线综合| 久久成人在线| 欧美午夜电影完整版| 久久久久久亚洲精品杨幂换脸| 美国三级日本三级久久99| 亚洲视频一区| 欧美超级免费视 在线| 亚洲一区二区精品视频| 久久九九国产| 欧美一区不卡| 欧美亚洲成人免费| 亚洲大片在线观看| 国产专区一区| 亚久久调教视频| 亚洲神马久久| 欧美国产激情二区三区| 久久久久久免费| 国产精品一区二区三区观看| 久久综合色8888| 国产欧美精品xxxx另类| 亚洲高清一区二| 1024国产精品| 久久蜜桃精品| 久久夜色精品| 国语自产精品视频在线看一大j8 | 久久九九全国免费精品观看| 亚洲国产另类 国产精品国产免费| 宅男精品视频| 亚洲小视频在线| 欧美三级视频| 在线视频一区观看| 亚洲夜间福利| 国产精品毛片| 亚洲欧美成人精品| 欧美一级日韩一级| 国产麻豆日韩| 久久精品女人| 亚洲第一色在线| 亚洲另类自拍| 欧美日韩视频专区在线播放 | 久久性天堂网| 1000部国产精品成人观看| 欧美亚洲尤物久久| 久久免费一区| 亚洲国产精品女人久久久| 久久精品一区二区三区中文字幕| 久久大综合网| 一区二区三区在线免费视频 | 久色成人在线| 亚洲国产精品va| 欧美成人中文| 一本色道久久88精品综合| 一区二区高清在线| 国产精品乱子久久久久| 亚洲欧美国产毛片在线| 久久精品女人| 亚洲日本中文字幕| 欧美无砖砖区免费| 欧美呦呦网站| 亚洲人成网站色ww在线| 一区二区三区|亚洲午夜| 欧美日韩黄视频| 午夜精品久久久久久久男人的天堂 | 亚洲精品四区| 欧美一区二区三区精品| 国产一区二区三区四区在线观看| 久久精品99国产精品酒店日本| 老司机精品久久| 在线中文字幕不卡| 国产亚洲欧美一区二区| 久久综合色8888| 中文精品在线| 亚洲国产成人精品女人久久久 | 免费日本视频一区| 中国日韩欧美久久久久久久久| 国产精品呻吟| 欧美激情一级片一区二区| 中文无字幕一区二区三区| 久久精品一区二区三区不卡牛牛 | 国产一区三区三区| 欧美激情一区二区三区成人 | 久久精品成人| 亚洲视频在线观看一区| 国产一区二区三区成人欧美日韩在线观看 | 亚洲精选大片| 韩国三级在线一区| 国产精品久久久久毛片大屁完整版| 欧美一区1区三区3区公司| 欧美激情第一页xxx| 亚洲欧美视频在线观看视频| 国产精品制服诱惑| 欧美日韩一本到| 欧美成人亚洲成人| 久久久97精品| 久久成人av少妇免费| 99国产精品视频免费观看一公开| 鲁大师成人一区二区三区| 亚洲免费在线电影| 亚洲天堂av在线免费| 亚洲高清中文字幕| 激情亚洲网站| 国产午夜精品在线观看| 欧美精品v国产精品v日韩精品| 欧美伊人久久大香线蕉综合69| 日韩小视频在线观看专区| 欧美韩日一区二区| 老司机久久99久久精品播放免费| 亚洲欧美日韩精品久久亚洲区| 亚洲三级视频在线观看| 狠狠综合久久av一区二区小说 | 久久永久免费| 久久久国产精品一区二区三区| 中文精品99久久国产香蕉| 亚洲黄色视屏| 亚洲精选在线观看| 亚洲精品精选| 一本色道久久加勒比88综合| 免费在线观看精品| 欧美91福利在线观看| 美女亚洲精品| 欧美顶级少妇做爰| 亚洲国产一区二区a毛片| 欧美激情一区二区三区成人| 性刺激综合网| 久久影视精品| 欧美激情一区二区三区高清视频| 久久三级福利| 欧美国产专区| 一本色道久久88综合亚洲精品ⅰ| 亚洲乱码国产乱码精品精| 最新高清无码专区| 夜夜嗨av色综合久久久综合网| 亚洲精品乱码久久久久久蜜桃麻豆| 亚洲国产精品一区在线观看不卡 | 一区二区三区产品免费精品久久75 | 国产一区二区三区四区老人| 国产精品福利av| 国产香蕉久久精品综合网| 国产一区视频网站| 91久久国产精品91久久性色| 伊人久久亚洲热| 99re8这里有精品热视频免费| 日韩视频在线观看| 亚洲欧美日韩国产一区| 欧美中文字幕视频| 欧美二区在线播放| 一本色道久久综合亚洲精品不卡 | 91久久久久久| 亚洲一区二区三区三| 欧美一区二区三区四区在线观看| 久久精品国产免费观看| 免费欧美电影| 国产欧美不卡| 日韩一区二区免费高清| 亚洲永久免费| 亚洲二区在线观看| 亚洲宅男天堂在线观看无病毒| 久久狠狠亚洲综合| 欧美日韩视频在线观看一区二区三区 | 亚洲欧洲日产国产网站| 亚洲图片欧美日产| 你懂的视频一区二区| 国产精品久久7| 亚洲精选在线| 欧美ed2k| 久久精品国产欧美激情| 欧美人牲a欧美精品| 国产亚洲a∨片在线观看|