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

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| 国产精品久久综合| 国产综合视频| 夜夜嗨av一区二区三区中文字幕 | 亚洲国产日韩欧美一区二区三区| 欧美大胆人体视频| 欧美亚洲成人免费| 亚洲丶国产丶欧美一区二区三区| 亚洲福利视频二区| 亚洲天堂偷拍| 亚洲激情欧美激情| 午夜精品久久久久久久白皮肤 | 亚洲精品国产精品国自产观看浪潮| 国产亚洲毛片| 亚洲午夜久久久| 久热爱精品视频线路一| 亚洲五月六月| 国产精品jvid在线观看蜜臀| 激情亚洲网站| 久久夜色精品国产亚洲aⅴ | 欧美中文日韩| 一区二区三区偷拍| 欧美精品一区二区三区在线播放| 欧美三级网址| 亚洲午夜精品久久久久久app| 国产精品白丝黑袜喷水久久久| 欧美视频在线观看| 中国成人在线视频| 99re这里只有精品6| 欧美激情精品久久久久久黑人| 国产九色精品成人porny| 中文无字幕一区二区三区| 亚洲人午夜精品| 欧美视频在线看| 久久精品一区| 榴莲视频成人在线观看| 亚洲国产一二三| av不卡在线观看| 国产午夜精品久久久久久免费视| 亚洲午夜性刺激影院| 亚洲免费精品| 国产欧美一区二区精品仙草咪 | 久久久一区二区三区| 亚洲国产高清在线| a4yy欧美一区二区三区| 国产一区二区视频在线观看| 另类专区欧美制服同性| 欧美日韩免费高清| 理论片一区二区在线| 欧美日韩第一区| 久久米奇亚洲| 欧美视频中文一区二区三区在线观看| 国产一区日韩一区| 亚洲精品欧美在线| 亚洲成人自拍视频| 午夜精品久久久久久久久 | 美女性感视频久久久| 亚洲欧美日韩视频一区| 狠狠色丁香久久综合频道| 欧美二区在线播放| 好看的亚洲午夜视频在线| 亚洲一区二区三区视频播放| 日韩亚洲综合在线| 欧美激情精品久久久久久变态| 亚洲视频福利| 欧美日韩一区成人| 一区二区三区.www| 亚洲欧美自拍偷拍| 国产精品一二三| 久久成人精品一区二区三区| 欧美影片第一页| 国内精品模特av私拍在线观看| 99综合视频| 欧美在线免费观看视频| 国产日产精品一区二区三区四区的观看方式 | 一本一本久久a久久精品综合妖精| 美女亚洲精品| 久久精品女人| 亚洲人成网在线播放| 亚洲免费成人| 国产精品欧美日韩一区| 亚洲欧美激情一区| 免费永久网站黄欧美| 中文在线一区| 在线播放国产一区中文字幕剧情欧美| 国产欧美精品在线观看| 免费不卡视频| 久久国产毛片| 午夜一区二区三视频在线观看| 欧美在线欧美在线| 亚洲国产精品高清久久久| 欧美系列亚洲系列| 乱人伦精品视频在线观看| 小黄鸭精品密入口导航| 宅男噜噜噜66一区二区| 亚洲国产成人精品久久久国产成人一区| 亚洲乱码国产乱码精品精| 国产自产精品| 国产综合视频在线观看| 国产乱码精品一区二区三区av| 美女精品在线观看| 久久伊人亚洲| 久久米奇亚洲| 欧美成人精品高清在线播放| 免费成人黄色| 欧美剧在线观看| 国产精品高精视频免费| 国产精品免费观看视频| 国产精品主播| 经典三级久久| 日韩一级不卡| 久久国产日韩欧美| 免费一级欧美片在线观看| 欧美一级成年大片在线观看| 午夜久久美女| 欧美bbbxxxxx| 亚洲激情av在线| 亚洲乱码精品一二三四区日韩在线| 中文高清一区| 久久天天躁夜夜躁狠狠躁2022| 亚洲综合电影| 欧美亚洲系列| 亚洲黄色大片| 久久国产精品99精品国产| 欧美激情一区二区三区在线视频| 久久米奇亚洲| 亚洲精品视频二区| 久久综合网络一区二区| 欧美人妖另类| 亚洲区一区二| 久久综合五月| 亚洲午夜三级在线| 久久婷婷蜜乳一本欲蜜臀| 欧美日韩亚洲高清| 亚洲二区在线观看| 久久不射电影网| 99国产精品一区| 麻豆精品视频在线观看| 国产欧美二区| 亚洲最新合集| 亚洲欧洲精品一区二区三区波多野1战4 | 久久成人18免费观看| 亚洲激情电影中文字幕| 午夜精品久久久久久99热| 久久成人综合网| 日韩视频在线播放| 欧美精品v国产精品v日韩精品| 欧美刺激性大交免费视频 | 亚洲高清不卡一区| 午夜亚洲视频| 国产欧美日韩视频一区二区三区| 亚洲麻豆av| 亚洲精品在线二区| 蜜臀av国产精品久久久久| 亚洲日本激情| 99精品欧美一区| 亚洲欧洲视频在线| 欧美日韩一区三区四区| 一区二区视频免费完整版观看| 欧美专区在线观看一区| 欧美国产综合一区二区| 亚洲人成艺术| 性欧美video另类hd性玩具| 在线观看亚洲视频| 亚洲欧美日韩精品久久| 亚洲激情在线播放| 亚洲欧美日韩中文在线制服| 在线成人av.com| 亚洲美洲欧洲综合国产一区| 亚洲一区二区在线播放| 亚洲激情国产| 久久国产精品一区二区| 亚洲精品乱码久久久久久蜜桃麻豆| 欧美黄色日本| 国产精品扒开腿做爽爽爽软件| 99精品国产在热久久下载| 亚洲欧美一级二级三级| 国产麻豆精品久久一二三| 亚洲第一综合天堂另类专| 欧美精品日韩三级| 蜜臀久久99精品久久久画质超高清 | 美女视频网站黄色亚洲| 欧美乱大交xxxxx|