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

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

<2025年9月>
31123456
78910111213
14151617181920
21222324252627
2829301234
567891011

導航

統計

常用鏈接

留言簿(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国内精品久久久久久久软件| 一区二区三区欧美| 国产精品在线看| 欧美**字幕| 夜夜嗨av一区二区三区四区| 午夜伦欧美伦电影理论片| 欧美激情精品久久久久久免费印度| 亚洲一本大道在线| 欧美日韩亚洲一区二区三区| 久久一区二区三区四区五区| 欧美激情综合在线| 亚洲人成网站色ww在线| 欧美日韩中文字幕综合视频| 欧美国产免费| 一区二区三区在线观看视频| 在线亚洲精品| 欧美一区二区视频网站| 国产精品久久久久久久第一福利| 99在线观看免费视频精品观看| 亚洲精品国产无天堂网2021| 久久亚洲精品中文字幕冲田杏梨 | 久久国产精品72免费观看| 欧美剧在线观看| 一级日韩一区在线观看| 亚洲视频香蕉人妖| 国产精品欧美日韩一区| 欧美在线高清| 欧美国产成人在线| 亚洲一区二区三区在线| 国产精品一区二区三区四区| 小黄鸭精品密入口导航| 免费视频一区| 欧美一级欧美一级在线播放| 在线不卡免费欧美| 国产精品亚洲综合天堂夜夜 | 欧美激情一区在线| 久久精品国产91精品亚洲| 西瓜成人精品人成网站| 91久久国产综合久久| 国产精品理论片在线观看| 久久免费精品视频| 亚洲字幕在线观看| 亚洲精选在线观看| 欧美国产精品中文字幕| 欧美主播一区二区三区| 亚洲乱码一区二区| 国内综合精品午夜久久资源| 欧美日本不卡高清| 欧美精品一区三区| 久久精品国产精品| 亚洲免费一在线| 亚洲直播在线一区| 在线亚洲免费| 亚洲婷婷在线| 亚洲天堂成人在线视频| 一本久道久久综合狠狠爱| 亚洲国产精品女人久久久| 欧美成人午夜剧场免费观看| 久久久久国产一区二区三区| 久久久99免费视频| 美女任你摸久久| 欧美成人精品1314www| 欧美大片在线观看一区| 亚洲丰满少妇videoshd| 91久久中文字幕| 亚洲天天影视| 久久综合影音| 国产精品区二区三区日本| 国产一区二区精品丝袜| 樱桃成人精品视频在线播放| 一区二区三区日韩| 久久五月激情| 亚洲特色特黄| 免费一级欧美片在线观看| 欧美日韩影院| 亚洲国产精品va在线看黑人动漫 | 免费观看在线综合色| 欧美三级网址| 好吊日精品视频| 久久精品国产一区二区三| 亚洲精品国产精品乱码不99按摩 | 国产视频一区三区| 午夜精品视频在线观看| 99在线热播精品免费99热| 欧美区在线播放| 亚洲视频第一页| 亚洲欧美日韩区| 国产欧美精品日韩区二区麻豆天美| 亚洲一区二区少妇| 亚洲神马久久| 亚洲电影网站| 日韩视频在线观看国产| 欧美亚洲第一区| 另类专区欧美制服同性| 亚洲色诱最新| 国产精品免费aⅴ片在线观看| 亚洲精品国产精品乱码不99按摩| 亚洲欧美日韩综合| 亚洲精品国产日韩| 欧美视频你懂的| 亚洲一区二区四区| 性做久久久久久免费观看欧美| 国产伦精品一区二区三区照片91| 欧美一区二区三区在线观看| 亚洲欧美日本日韩| 有坂深雪在线一区| 99re亚洲国产精品| 国产一区二区三区四区hd| 欧美大胆a视频| 国产精品大片免费观看| 美国成人毛片| 欧美日韩午夜| 欧美韩日一区二区| 国产欧美一区二区视频| 亚洲人成毛片在线播放女女| 国产精品视频午夜| 一区二区欧美日韩视频| 亚洲人成人一区二区三区| 欧美夜福利tv在线| 亚洲自拍偷拍网址| 国产精品国产一区二区| 欧美激情国产高清| 亚洲第一色中文字幕| 午夜精品成人在线| 久久大香伊蕉在人线观看热2| 欧美日韩在线视频一区二区| 亚洲春色另类小说| 亚洲成色777777在线观看影院| 国产精品一区三区| 亚洲欧美一区在线| 久久成人18免费观看| 国产欧美日韩中文字幕在线| 亚洲一级在线观看| 午夜一级久久| 欧美午夜不卡影院在线观看完整版免费| 麻豆精品精华液| 在线观看91久久久久久| 久久狠狠一本精品综合网| 久久久久久久999精品视频| 国产综合欧美在线看| 久久亚洲一区二区| 日韩性生活视频| 欧美主播一区二区三区美女 久久精品人 | 国产精品人成在线观看免费| 午夜一区二区三区在线观看 | 久久性天堂网| 国产精品乱码一区二三区小蝌蚪| 亚洲欧美精品| 亚洲人人精品| 久热国产精品| 亚洲一区二区三区中文字幕| 国产一区视频在线观看免费| 麻豆国产va免费精品高清在线| 一片黄亚洲嫩模| 欧美激情在线免费观看| 久久国产精品一区二区三区四区 | 亚洲国产高清aⅴ视频| 欧美在线免费观看亚洲| 亚洲精品美女91| 亚洲国产成人一区| 国产精品视频男人的天堂| 欧美久久影院| 欧美国产日韩在线| 老司机午夜免费精品视频| 亚洲欧美成人一区二区在线电影| 亚洲成人自拍视频| 欧美高清视频免费观看| 久久九九99视频| 久久精品在线| 久久久久国产一区二区三区四区| 亚洲午夜视频| 亚洲免费视频网站| 亚洲欧美在线x视频| 亚洲欧美日韩在线一区| 午夜一区二区三区在线观看| 午夜精品久久久久久99热| 欧美亚洲尤物久久| 久久露脸国产精品| 欧美国产日本韩| 夜夜嗨av一区二区三区中文字幕| 99国产精品久久久久久久久久| 夜夜嗨av一区二区三区四季av| 宅男66日本亚洲欧美视频| 欧美中文字幕在线观看| 久久不射2019中文字幕| 欧美一级电影久久| 久久一综合视频| 欧美日韩喷水| 精品99一区二区三区| 一本色道久久加勒比88综合| 午夜亚洲视频| 亚洲精品久久视频|