锘??xml version="1.0" encoding="utf-8" standalone="yes"?>久久国产精品久久久,欧美激情一区在线,亚洲精品在线看http://m.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://m.shnenglu.com/3144046cjc/archive/2009/07/21/90748.htmlChen JiecaoChen JiecaoTue, 21 Jul 2009 09:14:00 GMThttp://m.shnenglu.com/3144046cjc/archive/2009/07/21/90748.htmlhttp://m.shnenglu.com/3144046cjc/comments/90748.htmlhttp://m.shnenglu.com/3144046cjc/archive/2009/07/21/90748.html#Feedback0http://m.shnenglu.com/3144046cjc/comments/commentRss/90748.htmlhttp://m.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://m.shnenglu.com/3144046cjc/archive/2009/07/21/90747.htmlChen JiecaoChen JiecaoTue, 21 Jul 2009 09:12:00 GMThttp://m.shnenglu.com/3144046cjc/archive/2009/07/21/90747.htmlhttp://m.shnenglu.com/3144046cjc/comments/90747.htmlhttp://m.shnenglu.com/3144046cjc/archive/2009/07/21/90747.html#Feedback0http://m.shnenglu.com/3144046cjc/comments/commentRss/90747.htmlhttp://m.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://m.shnenglu.com/3144046cjc/archive/2009/07/20/90636.htmlChen JiecaoChen JiecaoMon, 20 Jul 2009 08:49:00 GMThttp://m.shnenglu.com/3144046cjc/archive/2009/07/20/90636.htmlhttp://m.shnenglu.com/3144046cjc/comments/90636.htmlhttp://m.shnenglu.com/3144046cjc/archive/2009/07/20/90636.html#Feedback0http://m.shnenglu.com/3144046cjc/comments/commentRss/90636.htmlhttp://m.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://m.shnenglu.com/3144046cjc/archive/2009/07/20/90624.htmlChen JiecaoChen JiecaoMon, 20 Jul 2009 07:00:00 GMThttp://m.shnenglu.com/3144046cjc/archive/2009/07/20/90624.htmlhttp://m.shnenglu.com/3144046cjc/comments/90624.htmlhttp://m.shnenglu.com/3144046cjc/archive/2009/07/20/90624.html#Feedback0http://m.shnenglu.com/3144046cjc/comments/commentRss/90624.htmlhttp://m.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://m.shnenglu.com/3144046cjc/archive/2009/07/19/90553.htmlChen JiecaoChen JiecaoSun, 19 Jul 2009 15:02:00 GMThttp://m.shnenglu.com/3144046cjc/archive/2009/07/19/90553.htmlhttp://m.shnenglu.com/3144046cjc/comments/90553.htmlhttp://m.shnenglu.com/3144046cjc/archive/2009/07/19/90553.html#Feedback0http://m.shnenglu.com/3144046cjc/comments/commentRss/90553.htmlhttp://m.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>
            久久久精品国产免大香伊| 久久久人成影片一区二区三区观看| 怡红院av一区二区三区| 99视频在线精品国自产拍免费观看 | 欧美伊人久久| 国产精品久久久久久久久久三级 | 在线综合亚洲欧美在线视频| 欧美xart系列在线观看| 欧美一区二区三区另类| 狠狠干成人综合网| 国产精品色婷婷| 一区二区三区成人精品| 欧美国产日韩视频| 久久蜜桃资源一区二区老牛| 国内精品久久久久久久果冻传媒| 亚洲欧美日本另类| 亚洲婷婷在线| 国产精品电影观看| 午夜久久tv| 小处雏高清一区二区三区| 国产麻豆精品theporn| 欧美尤物一区| 久久精品国产99国产精品| 一区二区三区在线免费播放| 免费观看久久久4p| 巨乳诱惑日韩免费av| 亚洲国产一区二区视频| 亚洲电影毛片| 欧美高清视频一区二区| 亚洲精品一区二区三区av| 亚洲国产一区二区精品专区| 欧美麻豆久久久久久中文| 正在播放日韩| 亚洲一级电影| 黄色欧美成人| 亚洲国产日韩一区二区| 欧美日韩在线免费观看| 欧美亚洲一区| 久久中文精品| 亚洲午夜一区二区三区| 亚洲欧美伊人| 亚洲国产精品一区| 99成人在线| 国产自产精品| 亚洲国产欧美一区二区三区同亚洲| 欧美男人的天堂| 性感少妇一区| 免费欧美视频| 香蕉亚洲视频| 免费观看亚洲视频大全| 亚洲一区欧美一区| 久久精品日韩一区二区三区| 亚洲精品一区二区三区99| 亚洲四色影视在线观看| 一区二区亚洲精品国产| 亚洲美洲欧洲综合国产一区| 国产三区二区一区久久| 免费人成精品欧美精品| 欧美日韩国产在线看| 久久男人资源视频| 欧美日韩一区二区免费在线观看 | 亚洲手机视频| 久久久精品国产免费观看同学 | 99这里只有久久精品视频| 国产一区二区精品在线观看| 亚洲第一主播视频| 国产日韩欧美一区在线 | 欧美日韩一区二区在线| 久久精品亚洲国产奇米99| 欧美日本一区二区三区 | 欧美成人dvd在线视频| 欧美在线日韩在线| 欧美日韩亚洲免费| 欧美激情片在线观看| 国一区二区在线观看| 亚洲一区尤物| 亚洲女同性videos| 欧美午夜片欧美片在线观看| 亚洲人成在线观看网站高清| 亚洲电影观看| 老色批av在线精品| 女同一区二区| 激情欧美丁香| 久久精品动漫| 久久综合99re88久久爱| 国内精品久久久久影院色| 欧美一区不卡| 久久精品人人爽| 国产农村妇女精品一区二区| 亚洲免费大片| 国产精品久久久久久久9999| 久久人人97超碰精品888| 国产精品成人午夜| 欧美高清在线播放| 欧美午夜精品一区| 亚洲一区黄色| 亚洲色无码播放| 欧美激情视频在线免费观看 欧美视频免费一| 西西裸体人体做爰大胆久久久 | 国内偷自视频区视频综合| 亚洲国产精品视频一区| 亚洲国产一区在线观看| 久久成人资源| 久久免费99精品久久久久久| 国产三级精品在线不卡| 亚洲欧美国产精品桃花| 亚洲国产一二三| 欧美日本在线观看| 亚洲精品久久久久| 亚洲精品资源美女情侣酒店| 欧美一区二区三区视频在线观看| 香港久久久电影| 欧美日韩mv| 亚洲日本久久| 激情久久综艺| 久久资源在线| 欧美国产欧美亚州国产日韩mv天天看完整| 国产午夜一区二区三区| 欧美一级在线视频| 欧美亚洲一区二区在线| 国产欧美一区在线| 久久福利一区| 欧美福利视频| 亚洲免费观看高清完整版在线观看熊 | 一二三区精品福利视频| 欧美成人一区二免费视频软件| 亚洲精品黄色| 亚洲欧美经典视频| 国产精品一区二区欧美| 欧美影院精品一区| 嫩草影视亚洲| 小嫩嫩精品导航| 国精产品99永久一区一区| 久久精品亚洲乱码伦伦中文 | 欧美不卡视频一区| 亚洲精品在线看| 亚洲在线免费视频| 国产精品久久久久久久久久尿| 亚洲欧美在线高清| 另类天堂av| aa日韩免费精品视频一| 国产精品天天看| 久久久久天天天天| 久久久久欧美精品| 亚洲一区二区三区777| 国产亚洲人成网站在线观看| 久久夜色精品国产亚洲aⅴ | 在线中文字幕不卡| 久久香蕉国产线看观看av| 国产一区激情| 欧美揉bbbbb揉bbbbb| 久久动漫亚洲| 日韩午夜电影| 老巨人导航500精品| 夜夜嗨一区二区三区| 国产一区二区三区久久久久久久久| 欧美高清在线观看| 性亚洲最疯狂xxxx高清| 亚洲人成亚洲人成在线观看| 久久久www成人免费精品| 亚洲精品国久久99热| 国产视频一区免费看| 亚洲欧美综合v| 日韩视频中午一区| 亚洲成人在线视频播放| 欧美在线91| 亚洲午夜激情免费视频| 亚洲国产三级| 亚洲国产日韩欧美在线图片| 国产一区二区成人| 国产精品久久久久av| 欧美激情影音先锋| 久久蜜桃精品| 免费成人高清| 久久精品二区亚洲w码| 亚洲欧美激情诱惑| 日韩一区二区高清| 亚洲电影观看| 男女激情视频一区| 欧美14一18处毛片| 久久久综合网站| 欧美一区视频在线| 亚洲欧美日韩一区二区在线| 日韩一区二区电影网| 一级日韩一区在线观看| 最新成人在线| 亚洲国语精品自产拍在线观看| 国产在线拍揄自揄视频不卡99| 国产精品久久久久久久9999| 久久九九精品| 欧美成人午夜剧场免费观看| 久久综合综合久久综合| 久久精品网址| 久久精品伊人| 久久久水蜜桃| 麻豆精品视频在线观看| 久久综合狠狠综合久久激情| 久久影院午夜片一区| 久久免费视频网站| 久久久久88色偷偷免费|