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

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>
            亚洲国产精品一区制服丝袜| 一本色道久久综合亚洲二区三区 | 亚洲一二三级电影| 亚洲国产另类久久久精品极度| 欧美 日韩 国产在线| 亚洲精品久久嫩草网站秘色| 亚洲精品少妇| 国产精品观看| 欧美中文在线免费| 久久久久久久久久久久久女国产乱 | 欧美精品在线网站| 亚洲一级二级在线| 欧美在线观看视频一区二区三区| …久久精品99久久香蕉国产 | 国产精品99久久久久久有的能看 | 美女啪啪无遮挡免费久久网站| 美女精品在线| 亚洲午夜女主播在线直播| 亚洲综合视频一区| 亚洲激情国产| 亚洲在线第一页| 91久久久亚洲精品| 亚洲午夜精品久久| 亚洲国产日韩欧美综合久久| 亚洲国产精品尤物yw在线观看| 欧美亚洲第一区| 欧美xx视频| 国产伦精品一区二区三区视频黑人| 久久久人成影片一区二区三区 | 久久久国产视频91| 一区二区三区国产在线| 欧美一区二区精品久久911| 日韩一区二区精品| 久久av免费一区| 亚洲综合999| 美女福利精品视频| 久久精品中文| 国产精品video| 亚洲欧洲精品成人久久奇米网| 国产麻豆91精品| av成人黄色| 亚洲欧洲一区二区在线播放| 性久久久久久久久久久久| 亚洲特级毛片| 欧美激情女人20p| 欧美成人精品在线| 国产一区再线| 亚洲女性喷水在线观看一区| 一区二区福利| 欧美大片一区二区三区| 麻豆精品91| 国产伊人精品| 午夜精品国产更新| 亚洲制服少妇| 欧美三级日韩三级国产三级| 亚洲激情视频网| 亚洲国产高清一区二区三区| 欧美一区二区三区四区夜夜大片 | 久久久久久综合网天天| 国产精品红桃| 亚洲一区国产| 欧美亚洲一区二区在线| 欧美视频一区二区在线观看| 亚洲美女视频在线观看| 日韩亚洲成人av在线| 欧美成人激情在线| 亚洲激情成人网| 一个色综合av| 欧美视频福利| 这里只有精品在线播放| 亚洲欧美一区二区三区极速播放| 欧美日本精品一区二区三区| 亚洲狼人综合| 午夜影院日韩| 国产综合在线视频| 久久一区视频| 亚洲三级电影在线观看| 一本大道久久a久久综合婷婷| 欧美精品电影在线| 在线视频精品一区| 午夜精品久久久久久久99热浪潮| 国产精品视频免费在线观看| 欧美一进一出视频| 女人天堂亚洲aⅴ在线观看| 亚洲国产mv| 欧美视频在线观看一区| 午夜精彩视频在线观看不卡 | 免费看亚洲片| 日韩图片一区| 国产精品一二三四区| 久久久.com| 亚洲精品久久久久久久久久久久 | 亚洲精品一区二区三区蜜桃久| 欧美精品久久99| 亚洲欧美日本视频在线观看| 蜜月aⅴ免费一区二区三区| 亚洲免费久久| 国产亚洲欧美日韩日本| 欧美a级一区二区| 亚洲私人影院| 欧美丰满少妇xxxbbb| 亚洲综合电影| 亚洲国产一区视频| 国产精品视频免费| 男人的天堂亚洲| 亚洲综合社区| 亚洲国产视频直播| 久久国产主播| 亚洲色无码播放| 亚洲国产成人av在线| 国产精品久久久免费| 蜜臀av一级做a爰片久久| 亚洲一区二区少妇| 亚洲国产精品电影| 久久夜色精品一区| 亚洲一区免费| 亚洲精品日韩欧美| 激情亚洲成人| 国产精品―色哟哟| 欧美日韩国产在线看| 久久九九精品99国产精品| 亚洲视频电影图片偷拍一区| 亚洲成色www8888| 久久综合伊人| 久久国产视频网| 亚洲欧洲av一区二区| 99在线精品观看| 亚洲人成人一区二区在线观看| 国产手机视频精品| 国产精品午夜在线| 国产精品v欧美精品v日本精品动漫| 毛片一区二区| 久久精品一区四区| 久久成人18免费网站| 亚洲欧美在线x视频| 亚洲婷婷在线| 中文日韩在线视频| 在线亚洲伦理| 亚洲午夜久久久久久尤物| 亚洲日本中文字幕| 亚洲人被黑人高潮完整版| 亚洲高清中文字幕| 最新69国产成人精品视频免费| 亚洲福利视频二区| 欧美成人xxx| 亚洲电影在线观看| 亚洲国产美女久久久久| 最近看过的日韩成人| 最新国产成人av网站网址麻豆| 欧美大胆人体视频| 亚洲电影中文字幕| 亚洲毛片视频| 亚洲一区二区高清视频| 亚洲免费网址| 久久精品国产一区二区三区免费看| 欧美一区二区播放| 久久久最新网址| 男女激情久久| 国产精品www.| 国内精品视频666| 亚洲高清不卡一区| 一区二区三区久久精品| 亚洲免费在线精品一区| 久久成人精品电影| 欧美a级片网站| 亚洲靠逼com| 亚洲男人影院| 美女精品在线| 国产精品ⅴa在线观看h| 国产日韩一区| 亚洲精品国产精品久久清纯直播| 99亚洲一区二区| 欧美一级片一区| 欧美高清视频免费观看| 日韩视频在线免费观看| 性亚洲最疯狂xxxx高清| 欧美大学生性色视频| 国产精品久久久久久久久免费 | 9人人澡人人爽人人精品| 香蕉免费一区二区三区在线观看 | 久久影院午夜论| 日韩视频免费在线观看| 午夜在线一区二区| 欧美久久精品午夜青青大伊人| 国产精品日韩欧美大师| 亚洲激情av| 欧美在线高清视频| 亚洲国内高清视频| 欧美一区二区三区在线观看| 欧美国产日韩亚洲一区| 国产亚洲欧洲一区高清在线观看| 日韩视频免费在线| 麻豆精品精华液| 亚洲专区一二三| 欧美精品一区二区三区蜜臀| 激情综合电影网| 性色av一区二区三区| 91久久综合| 久久综合久色欧美综合狠狠| 国产啪精品视频|