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

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

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

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{           //多項(xiàng)式求值
 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{  //多項(xiàng)式乘法
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 極限定律 閱讀(1206) 評(píng)論(0)  編輯 收藏 引用 所屬分類: ACM-ICPC World Final 2008題解


只有注冊(cè)用戶登錄后才能發(fā)表評(píng)論。
網(wǎng)站導(dǎo)航: 博客園   IT新聞   BlogJava   博問(wèn)   Chat2DB   管理


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

導(dǎo)航

統(tǒng)計(jì)

常用鏈接

留言簿(10)

隨筆分類

隨筆檔案

友情鏈接

搜索

最新評(píng)論

閱讀排行榜

評(píng)論排行榜

青青草原综合久久大伊人导航_色综合久久天天综合_日日噜噜夜夜狠狠久久丁香五月_热久久这里只有精品
  • <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>
            av成人福利| 亚欧美中日韩视频| 欧美精品亚洲二区| 亚洲精品影院在线观看| 亚洲青涩在线| 欧美午夜不卡在线观看免费 | 久久深夜福利| 国产一区二区三区久久精品| 亚洲综合日韩| 一区二区三区欧美日韩| 国产精品黄页免费高清在线观看| 狠狠色狠狠色综合日日五| 亚洲女ⅴideoshd黑人| 亚洲欧洲一二三| 另类春色校园亚洲| 伊人久久婷婷| 免费在线观看精品| 亚洲五月六月| 国产嫩草影院久久久久| 午夜视频在线观看一区二区| 亚洲影视综合| 在线观看一区视频| 亚洲激情一区二区三区| 欧美三级视频在线| 午夜精品久久久久久久99樱桃| 午夜精品一区二区三区电影天堂| 国产日韩精品视频一区二区三区| 久久影院午夜论| 欧美激情视频在线免费观看 欧美视频免费一 | 中文一区二区在线观看| 亚洲一区在线观看视频 | 午夜精品久久一牛影视| 国产一区亚洲| 亚洲国产精品va| 国产精品久在线观看| 欧美专区中文字幕| 美女诱惑一区| 亚洲一区免费| 久久天堂国产精品| 一区二区高清| 久久成人综合网| 一本久久知道综合久久| 欧美在线观看视频一区二区| 亚洲风情亚aⅴ在线发布| 一区二区日韩免费看| 一区二区亚洲| 亚洲视频中文| 亚洲人体偷拍| 欧美一区二区高清在线观看| 亚洲精品一区二区在线观看| 亚洲影院免费观看| 亚洲精品久久久久久久久久久久| 亚洲一区二区三区免费视频 | 欧美成人免费在线视频| 欧美一级黄色录像| 欧美日韩91| 免费观看久久久4p| 国产视频在线观看一区二区| 亚洲精品免费在线播放| 在线观看视频一区| 亚洲综合丁香| 亚洲一二三区在线观看| 美国成人直播| 久久婷婷影院| 国产视频精品va久久久久久| 99国产精品国产精品毛片| 亚洲激情成人网| 久久久亚洲午夜电影| 久久国产精品久久久久久久久久| 欧美破处大片在线视频| 欧美va亚洲va日韩∨a综合色| 国产精品青草久久| 一本色道**综合亚洲精品蜜桃冫| 亚洲国产成人av在线| 欧美一区二区| 久久久成人精品| 国产亚洲a∨片在线观看| 亚洲欧美精品| 欧美一区二区三区在| 国产精品最新自拍| 亚洲一区免费在线观看| 欧美亚洲视频在线看网址| 国产精品激情偷乱一区二区∴| 日韩午夜黄色| 亚洲欧美变态国产另类| 国产精品高精视频免费| 正在播放欧美一区| 一区二区欧美亚洲| 欧美精品久久久久久久| 亚洲免费福利视频| 亚洲综合三区| 国产麻豆精品在线观看| 香蕉久久精品日日躁夜夜躁| 久久成人免费电影| 国产主播一区二区三区| 久久这里只有| 亚洲欧洲日韩综合二区| 国产精品99久久久久久久久| 国产精品电影网站| 欧美一区二区三区免费观看视频| 久久激情综合网| 尤物yw午夜国产精品视频| 可以免费看不卡的av网站| 亚洲国产一区二区a毛片| aa级大片欧美三级| 国产精品欧美激情| 欧美一区视频在线| 亚洲高清123| 亚洲自拍电影| 精品91免费| 国产精品色一区二区三区| 久久精品视频免费播放| 91久久久久久久久久久久久| 亚洲欧美日韩国产成人精品影院| 国产欧美视频一区二区| 美女啪啪无遮挡免费久久网站| 亚洲人成7777| 久久久精品一品道一区| 99亚洲精品| 国产婷婷色一区二区三区在线| 久久夜色精品国产欧美乱极品 | 狠狠色丁香久久综合频道| 免费日韩av| 亚洲欧美日韩精品久久奇米色影视 | 99综合在线| 久久久久久久尹人综合网亚洲| 亚洲欧洲中文日韩久久av乱码| 国产精品人人做人人爽人人添| 六月婷婷一区| 性欧美xxxx大乳国产app| 亚洲精品一品区二品区三品区| 久久gogo国模啪啪人体图| 亚洲精品欧美在线| 狠狠入ady亚洲精品经典电影| 欧美日韩国产一区二区三区| 久久精品一区二区三区四区| av成人福利| 亚洲高清中文字幕| 麻豆久久婷婷| 久久久亚洲欧洲日产国码αv| 亚洲视频一区二区| 亚洲激情网站| 激情成人在线视频| 国产色综合久久| 国产精品久久久久久久久果冻传媒| 另类成人小视频在线| 久久国产精品一区二区| 亚洲一区精品在线| 一区二区久久久久| 99亚洲视频| 日韩视频专区| 亚洲免费av网站| 亚洲激情影院| 亚洲激情欧美| 亚洲国产欧美另类丝袜| 欧美国产激情二区三区| 性欧美大战久久久久久久久| 亚洲伦理在线观看| 国内精品一区二区| 国产精品一区免费视频| 欧美日韩一区二区视频在线 | 久久免费午夜影院| 欧美一区日韩一区| 午夜精品久久久久久久久久久| 一本色道久久88综合亚洲精品ⅰ| 亚洲经典在线看| 91久久黄色| 亚洲美女色禁图| 99精品99| 亚洲欧美成人一区二区三区| 一区二区三区精品在线| 亚洲视频网站在线观看| 亚洲一区二区三区涩| 亚洲欧美日韩精品久久亚洲区| 亚洲免费人成在线视频观看| 亚洲免费一在线| 欧美在线观看www| 久久精品亚洲一区二区| 免费观看在线综合色| 亚洲第一视频网站| 亚洲美女一区| 午夜一级久久| 久久久美女艺术照精彩视频福利播放 | 亚洲精品美女在线观看播放| 亚洲麻豆一区| 亚洲在线中文字幕| 久久裸体艺术| 亚洲片在线观看| 亚洲视频网在线直播| 性欧美videos另类喷潮| 久久免费视频在线| 欧美理论在线播放| 国产日产欧美精品| 亚洲第一视频网站| 亚洲在线观看视频| 美日韩免费视频| 中日韩美女免费视频网址在线观看| 新67194成人永久网站| 欧美激情一区| 国产自产v一区二区三区c|