锘??xml version="1.0" encoding="utf-8" standalone="yes"?>蜜臀久久99精品久久久久久9 ,久久av红桃一区二区小说,另类春色校园亚洲http://www.shnenglu.com/3144046cjc/category/11251.html鍍忚湕鐗涘暒婕zh-cnTue, 21 Jul 2009 20:28:05 GMTTue, 21 Jul 2009 20:28:05 GMT60URAL 1022 Genealogical treehttp://www.shnenglu.com/3144046cjc/archive/2009/07/21/90748.htmlChen JiecaoChen JiecaoTue, 21 Jul 2009 09:14:00 GMThttp://www.shnenglu.com/3144046cjc/archive/2009/07/21/90748.htmlhttp://www.shnenglu.com/3144046cjc/comments/90748.htmlhttp://www.shnenglu.com/3144046cjc/archive/2009/07/21/90748.html#Feedback0http://www.shnenglu.com/3144046cjc/comments/commentRss/90748.htmlhttp://www.shnenglu.com/3144046cjc/services/trackbacks/90748.html
 1 /* 鎷撴墤鎺掑簭 */
 2 
 3 #include<iostream>
 4 #include<vector>
 5 using namespace std;
 6 const int MAXN=120;
 7 vector<int> adj[MAXN];
 8 
 9 int into[MAXN];
10 
11 int main()
12 {
13   //freopen("data.in","r",stdin);
14   //freopen("data.out","w",stdout);
15   int n;
16   memset(into,0,sizeof(into));
17   cin >> n;
18   for (int i=1;i<=n;++i)
19     {
20       int x;
21       cin >> x;
22       while (x!=0
23     {
24       adj[i].push_back(x);
25       ++into[x];
26       cin >> x;
27     }
28     }
29  //for (int i=1;i<=n;++i) cout << into[i] << ' '; cout << endl;
30   bool everp=0;
31   for (int k=0;k<n;++k)
32     {
33       int i=1;
34       for (;i<=n;i++if (!into[i]) break;
35       (everp) ? cout << ' ' << i : cout << i;
36       everp=1;
37       --into[i];
38       for (int j=0;j<adj[i].size();++j) --into[ adj[i][j] ];
39     }
40   cout << endl;
41   return 0;
42 }
43 




Chen Jiecao 2009-07-21 17:14 鍙戣〃璇勮
]]>
URAL 1021 Sacrament of the sumhttp://www.shnenglu.com/3144046cjc/archive/2009/07/21/90747.htmlChen JiecaoChen JiecaoTue, 21 Jul 2009 09:12:00 GMThttp://www.shnenglu.com/3144046cjc/archive/2009/07/21/90747.htmlhttp://www.shnenglu.com/3144046cjc/comments/90747.htmlhttp://www.shnenglu.com/3144046cjc/archive/2009/07/21/90747.html#Feedback0http://www.shnenglu.com/3144046cjc/comments/commentRss/90747.htmlhttp://www.shnenglu.com/3144046cjc/services/trackbacks/90747.html
 1 #include<iostream>
 2 using namespace std;
 3 const int MAXN=50005;
 4 
 5 
 6 int main()
 7 {
 8   freopen("data.in","r",stdin);
 9   freopen("data.out","w",stdout);
10   int c,cc,num[MAXN];
11   cin >> c;
12   for (int i=0;i<c;++i) cin >> num[i];
13   num[c]=31440461;
14   cin >> cc;
15   int p=0;
16   for (int i=0;i<cc;++i)
17     {
18       int x;
19       cin >> x;
20       while (x+num[p]<10000++p;
21       if (x+num[p]==10000) { cout << "YES\n"return 0; }
22     }
23   cout << "NO\n";
24   return 0;
25 }
26 




Chen Jiecao 2009-07-21 17:12 鍙戣〃璇勮
]]>
URAL 1020 Ropehttp://www.shnenglu.com/3144046cjc/archive/2009/07/20/90636.htmlChen JiecaoChen JiecaoMon, 20 Jul 2009 08:49:00 GMThttp://www.shnenglu.com/3144046cjc/archive/2009/07/20/90636.htmlhttp://www.shnenglu.com/3144046cjc/comments/90636.htmlhttp://www.shnenglu.com/3144046cjc/archive/2009/07/20/90636.html#Feedback0http://www.shnenglu.com/3144046cjc/comments/commentRss/90636.htmlhttp://www.shnenglu.com/3144046cjc/services/trackbacks/90636.html
 1 #include<iostream>
 2 #include<math.h>
 3 using namespace std;
 4 const double PI=3.1415926;
 5 
 6 template <class T>
 7 T dis(T x1,T y1,T x2,T y2)
 8 {
 9   return sqrt( (x1-x2)*(x1-x2) + (y1-y2)*(y1-y2) );
10 }
11 int main()
12 {
13   int n;
14   double r,len=0;
15   //freopen("data.in","r",stdin);
16   //freopen("data.out","w",stdout);
17   cin >> n >> r;
18   double x0,y0,x,y;
19   cin >> x0 >> y0;
20   double px=x0,py=y0;
21 if (n==1goto L1;
22   for (int i=1;i<n;++i)
23     {
24       cin >> x >> y;
25       len+=dis(px,py,x,y);
26       px=x;
27       py=y;
28     }
29   len+=dis(x,y,x0,y0);
30 L1:  len+= 2*PI*r ;
31   printf("%.2f\n",len);
32   return 0;
33 }
34 




Chen Jiecao 2009-07-20 16:49 鍙戣〃璇勮
]]>
URAL 1019 A line paintinghttp://www.shnenglu.com/3144046cjc/archive/2009/07/20/90624.htmlChen JiecaoChen JiecaoMon, 20 Jul 2009 07:00:00 GMThttp://www.shnenglu.com/3144046cjc/archive/2009/07/20/90624.htmlhttp://www.shnenglu.com/3144046cjc/comments/90624.htmlhttp://www.shnenglu.com/3144046cjc/archive/2009/07/20/90624.html#Feedback0http://www.shnenglu.com/3144046cjc/comments/commentRss/90624.htmlhttp://www.shnenglu.com/3144046cjc/services/trackbacks/90624.htmlA Line painting
Time Limit: 2.0 second
Memory Limit: 16 MB
The segment of numerical axis from 0 to 109 is painted into white color. After that some parts of this segment are painted into black, then some into white again and so on. In total there have been made N re-paintings (1 ≤ N ≤ 5000). You are to write a program that finds the longest white open interval after this sequence of re-paintings.

Input

The first line of input contains the only number N. Next N lines contain information about re-paintings. Each of these lines has a form:
ai bi ci
where ai and bi are integers, ci is symbol 'b' or 'w', ai, bi, ci are separated by spaces.
This triple of parameters represents repainting of segment from ai to bi into color ci ('w' 鈥?white, 'b' 鈥?black). You may assume that 0 < ai < bi < 109.

Output

Output should contain two numbers x and y (x < y) divided by space(s). These numbers should define the longest white open interval. If there are more than one such an interval output should contain the one with the smallest x.

Sample

input output
4
1 999999997 b
40 300 w
300 634 w
43 47 b
47 634                                                        
榪欎釜棰樼洰鏈鐩存帴鐨勫姙娉曟槸紱繪暎鍖?紱繪暎鍖栦簡涔嬪悗灝卞ソ鎶樿吘浜?鍥犱負鎿嶄綔鎸囦護寰堝皯,鎵浠ユ垜閫夋嫨紱繪暎+鏈寸礌鏌撹壊.
澶嶆潅搴︿笂鐣屼負O(M*M),榪欓噷M琛ㄧず紱繪暎鍖栧悗寰楀埌鐨勫尯闂翠釜鏁?

 1 #include<iostream>
 2 #include<algorithm>
 3 using namespace std;
 4 const int MAXN=10005;
 5 const int MAXL=1000000000;
 6 struct re
 7 {
 8   int a,b;
 9   char c;
10 }op[MAXN];
11 
12 int n,p=0,que[MAXN];
13 bool color[MAXN<<1];
14 
15 /* 浜屽垎鏌ユ壘 */
16 int find(int num)
17 {
18   int l=0,r=p+1,mid;
19   while (r-l>1)
20     {
21       mid=(l+r) >> 1;
22       (que[mid]<=num)? l=mid : r=mid;
23       if (que[l]==num) return l;
24     }
25   return l;
26 }
27 
28 void disp(re& op)
29 {
30   /* 鍖洪棿鐢?寮濮嬫暟,鑰屼笉鏄敱0寮濮?nbsp;*/
31   op.a=find(op.a)+1;
32   op.b=find(op.b);
33 }
34 
35 void mark(int l,int r,char c)
36 {
37   for (int i=l;i<=r;++i) color[i]=(c=='b');
38 }
39 
40 int main()
41 {
42  // freopen("data.in","r",stdin);
43  // freopen("data.out","w",stdout);
44   cin >> n;
45   for (int i=0;i<n;++i)
46     {
47       cin >> op[i].a >> op[i].b >> op[i].c;
48       que[++p]=op[i].a;
49       que[++p]=op[i].b;
50     }
51   que[++p]=MAXL;
52   /* 鍒犻櫎閲嶅鍑虹幇鐨勬暟瀛?nbsp;*/
53   int rp=0;
54   for (int i=1;i<=p;++i)
55     if (que[rp]!=que[i]) que[++rp]=que[i];
56   p=rp;
57   /* 鎺掑簭,渚夸簬瀹氫綅鍜岀鏁e寲 */
58   sort(que,que+p+1);
59   que[p+1]=MAXL+1;
60   /* 瀵規搷浣滆繘琛岀鏁e鐞?nbsp;*/
61   for (int i=0;i<n;++i) disp(op[i]);
62   /* 澶勭悊鎿嶄綔搴忓垪 */
63   memset(color,0,sizeof(color));
64   for (int i=0;i<n;++i) mark(op[i].a,op[i].b,op[i].c);
65   int t=1,a,b,mlen=0;
66   for (int i=2;i<=p+1;++i)
67     if (color[i]!=color[t] || i>p)
68       { 
69     if ((!color[t]) && (que[i-1]-que[t-1]>mlen)) { a=que[t-1];b=que[i-1];mlen=que[i-1]-que[t-1];}
70     t=i;
71       }
72   cout << a << ' ' << b << endl;
73   //system("pause");
74   return 0;
75 }
76 
涓埆鐩爣榪滃ぇ鐨勫悓瀛﹀彲鑳藉茍涓嶄粎浠呮槸鎯寵В鍐寵繖涓鐩?榪欐椂鍊欏緩璁綘浣跨敤紱繪暎鍖?綰挎鏍?澶嶆潅搴︿細澶уぇ鍦伴檷浣?br>

Chen Jiecao 2009-07-20 15:00 鍙戣〃璇勮
]]>
URAL 1018 A Binary Apple Treehttp://www.shnenglu.com/3144046cjc/archive/2009/07/19/90553.htmlChen JiecaoChen JiecaoSun, 19 Jul 2009 15:02:00 GMThttp://www.shnenglu.com/3144046cjc/archive/2009/07/19/90553.htmlhttp://www.shnenglu.com/3144046cjc/comments/90553.htmlhttp://www.shnenglu.com/3144046cjc/archive/2009/07/19/90553.html#Feedback0http://www.shnenglu.com/3144046cjc/comments/commentRss/90553.htmlhttp://www.shnenglu.com/3144046cjc/services/trackbacks/90553.html

A Binary Apple Tree


Time Limit: 1.0 second
Memory Limit: 16 MB
Let's imagine how apple tree looks in binary computer world. You're right, it looks just like a binary tree, i.e. any biparous branch splits up to exactly two new branches. We will enumerate by natural numbers the root of binary apple tree, points of branching and the ends of twigs. This way we may distinguish different branches by their ending points. We will assume that root of tree always is numbered by 1 and all numbers used for enumerating are numbered in range from 1 to N, where N is the total number of all enumerated points. For instance in the picture below N is equal to 5. Here is an example of an enumerated tree with four branches:
2   5
\ /
3 4
\ /
1
As you may know it's not convenient to pick an apples from a tree when there are too much of branches. That's why some of them should be removed from a tree. But you are interested in removing branches in the way of minimal loss of apples. So your are given amounts of apples on a branches and amount of branches that should be preserved. Your task is to determine how many apples can remain on a tree after removing of excessive branches.

Input

First line of input contains two numbers: N and Q (1 ≤ QN; 1 < N ≤ 100). N denotes the number of enumerated points in a tree. Q denotes amount of branches that should be preserved. Next N−1 lines contains descriptions of branches. Each description consists of a three integer numbers divided by spaces. The first two of them define branch by it's ending points. The third number defines the number of apples on this branch. You may assume that no branch contains more than 30000 apples.

Output

Output should contain the only number 鈥?amount of apples that can be preserved. And don't forget to preserve tree's root ;-)

Sample

input output
5 2
1 3 1
1 4 10
2 3 20
3 5 20
                                 21

綆鏋?
      榪欐槸涓涓畝鍗曠殑鏍戝艦鍔ㄦ佽鍒掗棶棰?澶ф鍙互鎷挎潵褰撹繖綾婚鐩殑鍏ラ棬璁粌棰?铏界劧榪欐槸URAL涓婄殑絎竴涓爲褰P,浣嗘槸鎴戝鎬殑鏄畠鐨勯氳繃鐜囧茍涓嶅緢楂?
      瀵逛簬鍘熼鐩殑鍥懼艦,鐢ㄦ暟緇剉alue[a][b]琛ㄧずa,b鐐歸棿鑻規灉鐨勪釜鏁?鐢╪d[p].L,nd[p].R鍒嗗埆琛ㄧず鑺傜偣p鐨勫乏鍙沖効瀛?閫氳繃build_tree(1)鑾峰緱鏁扮粍nd[],浠庤岃幏寰楁暣媯墊爲鐨勪俊鎭?
鎺ョ潃,鐢╝ns[p][i]琛ㄧず浠ヨ妭鐐筽涓虹瀹楃殑瀛愭爲,淇濈暀鐨勬灊鏉′笉瓚呰繃i鏉℃椂鎵鑳戒繚鐣欑殑鏈澶氱殑鑻規灉,鐘舵佽漿縐繪湁涓涓嬪嚑縐嶆儏鍐?
鍦ㄩ櫎鍘誨浣欐灊鏉$殑鍚庣殑鍥句腑,
1.  p鍙笌涓涓効瀛愮浉榪?
    ans[p][i]=max(ans[left_son][i-1]+value[left_son][p],ans[right_son][i-1]+value[right_son][p]);
2.  p涓庝袱涓効瀛愮浉榪?
    for (int j=0;j<=i-2;++j)
      ans[p][i]=max(ans[p][i],ans[left_son][j]+ans[right_son][i-j-2]+d); 
    榪欓噷,d=value[left_son][p]+value[right_son][p];

綆楁硶鍦╫(N*Q*Q)綰у埆
 1 #include<iostream>
 2 using namespace std;
 3 const int MAXN=102;
 4 int n,q,value[MAXN][MAXN],ans[MAXN][MAXN];
 5 struct node
 6 {
 7   int l,r;
 8 }nd[MAXN];
 9 
10 void build_tree(int p)
11 {
12   int flg=0;
13   for (int i=1;i<=n;++i)
14     if (value[p][i] && (!nd[i].l))
15       {
16     flg=1;
17     if (nd[p].l==0) nd[p].l=i;
18     else
19       {nd[p].r=i; break;}
20       }
21   if (!flg) return;
22   if (nd[p].l) build_tree(nd[p].l);
23   if (nd[p].r) build_tree(nd[p].r);
24 }
25 
26 void calc(int p)
27 {
28   if (!nd[p].l) return;
29   int l=nd[p].l,r=nd[p].r;
30   calc(l);
31   calc(r);
32   ans[p][1]=max(value[l][p],value[r][p]);
33 
34   int d=value[l][p]+value[r][p];
35   for (int i=2;i<=q;++i)
36   {  
37     ans[p][i]=max(ans[l][i-1]+value[l][p],ans[r][i-1]+value[r][p]);
38     for (int j=0;j<=i-2;++j)
39       ans[p][i]=max(ans[p][i],ans[l][j]+ans[r][i-j-2]+d);
40   }
41 }
42 
43 
44 int main()
45 {
46   //freopen("data.in","r",stdin);
47   //freopen("data.out","w",stdout);
48   cin >> n >> q;
49   memset(value,0,sizeof(value));
50   for (int i=1;i<n;++i)
51     {
52       int a,b,c;
53       cin >> a >> b >> c;
54       value[a][b]=c;
55       value[b][a]=c;
56     }
57   memset(nd,0,sizeof(nd));
58   build_tree(1);
59   calc(1);
60   cout << ans[1][q] << endl;
61   return 0;
62 }
63 





Chen Jiecao 2009-07-19 23:02 鍙戣〃璇勮
]]>
青青草原综合久久大伊人导航_色综合久久天天综合_日日噜噜夜夜狠狠久久丁香五月_热久久这里只有精品
  • <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>
            久久久国产亚洲精品| 欧美精彩视频一区二区三区| 亚洲美女毛片| 开心色5月久久精品| 久久夜色撩人精品| 亚洲黄页一区| 亚洲国产专区校园欧美| 亚洲蜜桃精久久久久久久| 一区二区电影免费观看| 久久国产加勒比精品无码| 欧美激情一区| 亚洲欧美一区二区激情| 麻豆国产精品一区二区三区| 国产精品极品美女粉嫩高清在线| 红桃视频亚洲| 欧美一区2区视频在线观看| 亚洲高清视频一区| 亚洲欧美欧美一区二区三区| 欧美国产日韩一区二区| 韩国在线视频一区| 欧美激情一二区| 国产精品国产馆在线真实露脸| 久久精品视频在线播放| 亚洲一区图片| 欧美亚男人的天堂| 一本色道久久88综合日韩精品| 嫩草伊人久久精品少妇av杨幂| 亚洲欧美日韩国产| 91久久线看在观草草青青| 另类人畜视频在线| 欧美日韩精品二区| 亚洲精品黄色| 亚洲国产成人tv| 国产精品一区在线观看| 亚洲一级影院| 一本到12不卡视频在线dvd| 欧美xart系列在线观看| 亚洲第一黄网| 理论片一区二区在线| 欧美体内谢she精2性欧美| 亚洲经典视频在线观看| 亚洲在线观看视频网站| 亚洲精品视频免费在线观看| 欧美一区二区日韩| 国产农村妇女精品| 久久国内精品自在自线400部| 欧美激情精品久久久久久大尺度 | 在线不卡免费欧美| 久久中文字幕一区| 国产精品久久久久久久app| 亚洲国产精品电影| 免费观看日韩| 一本色道久久综合亚洲精品小说 | 亚洲精品裸体| 欧美午夜www高清视频| 亚洲国产一区二区三区高清| 国产在线欧美| 另类尿喷潮videofree| 国产乱码精品一区二区三| 亚洲精品视频在线| 亚洲精品美女久久7777777| 久久影音先锋| 日韩视频在线观看国产| 中文欧美日韩| 精品动漫一区| 亚洲欧洲美洲综合色网| 亚洲人成人77777线观看| 快播亚洲色图| 亚洲大片在线| 日韩午夜激情| 欧美日本一区| 久久先锋影音av| 国内精品久久久久影院 日本资源| 亚洲欧美日韩成人高清在线一区| 亚洲一区二区三| 国产精品日韩久久久| 欧美国产视频一区二区| 亚洲国产一区二区三区高清| 免费久久99精品国产自在现线| 亚洲第一在线综合在线| 日韩天堂在线观看| 欧美亚韩一区| 欧美中文在线视频| 亚洲视频在线看| 蘑菇福利视频一区播放| 亚洲日本免费电影| 亚洲欧美视频| 欧美成人dvd在线视频| 亚洲裸体在线观看| 性欧美18~19sex高清播放| 欧美成人自拍视频| 一区二区三区久久精品| 亚洲精品你懂的| 国产精品成人aaaaa网站| 亚洲欧美制服中文字幕| 老司机67194精品线观看| 最新国产拍偷乱拍精品| 欧美视频一区二区三区四区| 亚洲欧美日韩视频一区| 欧美成人网在线| 国产真实乱子伦精品视频| 久久在线免费观看视频| 中文国产成人精品久久一| 久久久亚洲人| 韩国一区电影| 欧美日韩在线一区二区三区| 欧美一区午夜视频在线观看| 欧美激情亚洲一区| 欧美一区三区三区高中清蜜桃| 亚洲大片免费看| 国产精品一区二区三区免费观看| 麻豆91精品| 亚洲欧美日韩在线高清直播| 亚洲国产视频一区| 久久手机精品视频| 亚洲尤物精选| 国产精品免费在线| 这里只有精品视频| 欧美福利精品| 久久嫩草精品久久久精品| 中文精品视频一区二区在线观看| 激情五月综合色婷婷一区二区| 欧美日韩午夜| 亚洲综合成人婷婷小说| 亚洲欧洲另类国产综合| 久久综合999| 久久精品成人一区二区三区蜜臀| 宅男噜噜噜66一区二区| 亚洲欧洲一区二区天堂久久| 好看的亚洲午夜视频在线| 国产精品免费aⅴ片在线观看| 欧美二区乱c少妇| 久久视频这里只有精品| 亚洲高清在线精品| 久热精品视频在线| 欧美一区二区三区在线看| 亚洲一区二区精品视频| 一区二区三区.www| 亚洲精品在线免费观看视频| 亚洲高清色综合| 欧美日韩免费观看一区三区| 模特精品裸拍一区| 农村妇女精品| 欧美极品aⅴ影院| 欧美成人福利视频| 欧美激情精品久久久久久久变态 | 另类天堂av| 久久在线视频在线| 乱码第一页成人| 免播放器亚洲一区| 欧美.www| 欧美裸体一区二区三区| 欧美伦理视频网站| 欧美日韩一区二区在线视频 | 欧美日韩一区二区在线视频| 欧美日韩精品久久久| 欧美日韩免费观看一区三区| 欧美午夜欧美| 国产精品自拍视频| 国内精品福利| 亚洲激情六月丁香| 亚洲精品午夜| 亚洲欧美春色| 亚洲激情一区二区三区| 亚洲伦理自拍| 亚洲欧美精品在线观看| 欧美一区二区三区在线视频| 久久噜噜噜精品国产亚洲综合 | 日韩一区二区电影网| 99精品视频一区二区三区| 亚洲一区二区三区午夜| 欧美一级播放| 欧美韩日视频| 在线亚洲精品福利网址导航| 欧美一区二区三区免费观看视频 | 亚洲激情中文1区| 9色精品在线| 久久精品视频va| 亚洲一区二区三区视频| 午夜亚洲影视| 欧美一区二区三区久久精品茉莉花| 久久精品一级爱片| 欧美精品七区| 加勒比av一区二区| 在线视频欧美精品| 久久综合久久美利坚合众国| 亚洲精品国产欧美| 欧美与欧洲交xxxx免费观看| 欧美黄色影院| 激情欧美一区二区| 亚洲视频福利| 欧美激情精品久久久久久变态| 亚洲一区www| 亚洲深夜福利视频| 蜜桃av一区二区三区| 国产精品区二区三区日本| 亚洲区在线播放| 久久这里只有| 亚洲男人影院| 欧美午夜精品久久久久久超碰|