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

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>
            久久另类ts人妖一区二区| 在线中文字幕一区| 久久在精品线影院精品国产| 国产毛片精品国产一区二区三区| 亚洲一区中文字幕在线观看| 在线亚洲电影| 国产亚洲欧美日韩日本| 久久影院午夜片一区| 玖玖精品视频| 一区二区三区四区五区精品| 亚洲综合精品四区| 在线看无码的免费网站| 国产欧美一区二区白浆黑人| 久久精品国产一区二区三区| 麻豆精品精华液| 亚洲女同精品视频| 欧美一区久久| 在线视频一区二区| 久久av红桃一区二区小说| 亚洲美女av网站| 亚洲欧美日韩中文播放| 亚洲精品在线视频| 性欧美video另类hd性玩具| 亚洲激情电影在线| 亚洲午夜羞羞片| 亚洲精品美女在线观看| 香蕉精品999视频一区二区| 亚洲精品久久久久中文字幕欢迎你| 一区二区国产在线观看| 激情文学综合丁香| 亚洲性感激情| 亚洲毛片在线免费观看| 久久精品在线| 亚洲欧美日韩中文视频| 欧美电影资源| 久久久噜噜噜久久久| 国产精品家教| 亚洲激情第一区| 国产一区二区三区免费不卡| 日韩五码在线| 亚洲精品在线观| 久久久久综合网| 久久精品首页| 国产精品久久99| 亚洲裸体俱乐部裸体舞表演av| 激情综合色综合久久| 亚洲欧美成人| 亚洲欧美日韩国产综合精品二区| 免费在线观看精品| 蜜桃av久久久亚洲精品| 国产欧美在线| 亚洲综合色在线| 亚洲欧美日韩第一区| 欧美日韩亚洲一区二| 亚洲激情在线播放| 亚洲欧洲在线视频| 美日韩免费视频| 欧美大片在线影院| 亚洲国产欧美国产综合一区| 久久精品综合一区| 开心色5月久久精品| 一区二区三区在线观看欧美 | 一区二区三区高清在线观看| 女生裸体视频一区二区三区| 免费欧美视频| 亚洲国产天堂久久综合网| 免费试看一区| 亚洲日本欧美| 亚洲一级片在线观看| 国产精品成人在线| 午夜国产精品视频免费体验区| 午夜精品久久久久久久男人的天堂| 欧美香蕉大胸在线视频观看| 一区二区三区久久久| 午夜天堂精品久久久久 | 久久综合色一综合色88| 欧美激情va永久在线播放| 欧美在线视频在线播放完整版免费观看 | 久久综合久久综合这里只有精品| 欧美超级免费视 在线| 亚洲欧洲精品一区二区三区波多野1战4 | 亚洲欧洲在线一区| 欧美精品在线观看91| 一区二区三区黄色| 久久精品综合| 亚洲精品在线电影| 欧美天堂亚洲电影院在线播放 | 亚洲精品一区在线观看香蕉| 亚洲最新视频在线| 国产精品最新自拍| 另类av导航| 亚洲午夜精品网| 每日更新成人在线视频| 一区二区三区免费看| 国产日本精品| 欧美bbbxxxxx| 亚洲免费综合| 亚洲激情视频在线| 久久国产精品99国产| 亚洲欧洲精品一区二区精品久久久| 欧美日本不卡视频| 久久国产婷婷国产香蕉| 国产一区二三区| 老巨人导航500精品| 最新成人在线| 国产精品v片在线观看不卡 | 日韩视频在线一区二区三区| 久久久久久网址| 亚洲综合欧美日韩| 亚洲电影免费观看高清| 国产精品久久久久久久久免费| 开心色5月久久精品| 午夜精品亚洲| 一本大道av伊人久久综合| 免费视频一区| 久久久人成影片一区二区三区| 亚洲天堂黄色| 亚洲精品综合精品自拍| 国内一区二区三区| 国产精品视频专区| 国产精品成人国产乱一区| 欧美 日韩 国产一区二区在线视频 | 亚洲在线免费观看| 亚洲乱码国产乱码精品精天堂| 国产色综合天天综合网| 国产精品久久久久久久久婷婷| 欧美777四色影视在线| 欧美插天视频在线播放| 欧美成人免费va影院高清| 欧美一区二区在线| 国产精品99久久久久久宅男| 最新国产成人av网站网址麻豆| 狠狠久久婷婷| 尤物yw午夜国产精品视频明星| 国产欧美一区二区三区视频| 奶水喷射视频一区| 久久久久久久综合日本| 欧美一级免费视频| 久久超碰97中文字幕| 亚洲欧美综合网| 性色av香蕉一区二区| 欧美一区二区三区四区高清| 亚洲欧美春色| 亚洲自拍偷拍一区| 午夜国产精品影院在线观看| 亚洲欧美一区二区精品久久久| 亚洲一区二区在线| 午夜一区二区三区在线观看| 性欧美videos另类喷潮| 久久www成人_看片免费不卡| 久久激情婷婷| 你懂的视频欧美| 91久久国产综合久久蜜月精品 | 久久综合激情| 亚洲电影免费观看高清完整版| 欧美激情精品久久久久久变态| 亚洲高清久久| 亚洲视频欧美在线| 亚久久调教视频| 美女视频黄a大片欧美| 欧美激情1区2区| 国产精品大全| 伊人久久成人| 99成人在线| 欧美一级艳片视频免费观看| 久久久久免费观看| 欧美黄色大片网站| 在线亚洲美日韩| 久久久久久久网| 欧美日本三级| 国产日产亚洲精品系列| 亚洲国产日韩欧美在线99| 在线一区二区三区做爰视频网站| 午夜激情综合网| 欧美成人情趣视频| 亚洲一区二区不卡免费| 久久国产乱子精品免费女| 欧美日韩国产美| 国产一区再线| 亚洲无玛一区| 欧美成人免费在线| 亚洲影音先锋| 欧美另类女人| 一区二区亚洲精品国产| 亚洲视频狠狠| 欧美1区2区3区| 中日韩美女免费视频网址在线观看| 久久精品伊人| 国产伦精品一区二区三区四区免费| 亚洲国产视频a| 久久久久久国产精品一区| 亚洲精品一区二区在线| 久久久久成人精品| 亚洲国产精品va| 久久xxxx| 国产日本欧美一区二区三区| 一区二区91| 亚洲国产色一区| 久久青青草综合| 狠狠色噜噜狠狠色综合久|