锘??xml version="1.0" encoding="utf-8" standalone="yes"?>亚洲精品国产字幕久久不卡,99久久国产免费福利,俺来也俺去啦久久综合网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 鍙戣〃璇勮
]]>
中文成人久久久久影院免费观看 | 亚洲中文字幕无码一久久区| 亚洲伊人久久综合影院| 囯产极品美女高潮无套久久久| 亚洲中文字幕无码久久2017| AV狠狠色丁香婷婷综合久久| 久久精品免费大片国产大片| 久久久久久久久波多野高潮| 国产精品99久久精品| 亚洲国产成人精品久久久国产成人一区二区三区综 | 九九精品久久久久久噜噜| 久久人人爽人人爽人人片AV不 | 色综合久久综精品| 欧美国产成人久久精品| 久久精品人人做人人爽电影| 久久夜色精品国产www| 久久亚洲私人国产精品| 亚洲精品WWW久久久久久| 久久精品视频免费| 99久久精品免费看国产一区二区三区 | 久久青青草原亚洲av无码| 日产精品久久久久久久| 最新久久免费视频| 青青草国产精品久久| 久久婷婷五月综合97色一本一本 | 久久久久久毛片免费播放| 久久久久国产精品三级网| 九九久久99综合一区二区| 漂亮人妻被黑人久久精品| 亚洲国产高清精品线久久| 久久国产精品偷99| 色综合久久久久网| 91秦先生久久久久久久| 一本色道久久88加勒比—综合| 久久精品无码专区免费东京热| 亚洲中文字幕无码久久2020| 亚洲国产精品无码久久久不卡| 国内精品伊人久久久久777| 久久天天躁夜夜躁狠狠躁2022| 一本色综合久久| 久久婷婷午色综合夜啪|