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

superman

聚精會神搞建設 一心一意謀發展
posts - 190, comments - 17, trackbacks - 0, articles - 0
   :: 首頁 :: 新隨筆 :: 聯系 :: 聚合  :: 管理

 1 /* Accepted 1372 C++ 00:00.33 848K */
 2 #include <iostream>
 3 
 4 using namespace std;
 5 
 6 int main()
 7 {
 8     int n, m, map[50][50];
 9     
10     while(cin >> n >> m)
11     {
12         for(int i = 0; i < n; i++)
13         for(int j = 0; j < n; j++)
14             map[i][j] = INT_MAX;
15         
16         int s, t, l;
17         for(int i = 0; i < m; i++)
18         {
19             cin >> s >> t >> l;
20             s--, t--;
21             if(l < map[s][t] && l < map[t][s])
22                 map[s][t] = map[t][s] = l;
23         }
24         
25         if(n == 0 || m == 0)
26         {
27             cout << 0 << endl; continue;
28         }
29         
30         //prim
31         int ans = 0;
32         int lowcost[50];
33         bool vset[50= { true };
34         
35         for(int i = 1; i < n; i++)
36             lowcost[i] = map[0][i];
37         int v = 0;
38         for(int k = 1; k < n; k++)
39         {
40             int min = INT_MAX, idx;
41             for(int i = 0; i < n; i++)
42                 if(vset[i] == false && lowcost[i] < min)
43                     min = lowcost[i], idx = i;
44             
45             vset[idx] = true;
46             v = idx;
47             
48             ans += min;
49             
50             for(int i = 0; i < n; i++)
51                 if(vset[i] == false && map[v][i] < lowcost[i])
52                     lowcost[i] = map[v][i];
53         }
54         
55         cout << ans << endl;
56     }
57     
58     return 0;
59 }
60 

posted @ 2008-06-05 16:44 superman 閱讀(212) | 評論 (0)編輯 收藏

 1 /* Accepted 1366 C++ 00:09.36 936K */
 2 #include <iostream>
 3 
 4 using namespace std;
 5 
 6 int main()
 7 {
 8     int cash, N, n[11], d[11];
 9     bool x[100001];
10     
11     while(cin >> cash >> N)
12     {
13         for(int i = 1; i <= N; i++)
14             scanf("%d %d", n + i, d + i);
15         
16         memset(x, false, cash + 1);
17         
18         x[0= true;
19         for(int i = 1; i <= N; i++)
20             for(int j = cash; j >= d[i]; j--)
21                 for(int k = 1; k <= n[i]; k++)
22                     if(d[i] * k <= j)
23                         x[j] = x[j] || x[j - d[i] * k];
24                     else
25                         break;
26         for(int i = cash; i >= 0; i--)
27             if(x[i])
28             {
29                 cout << i << endl; break;
30             }
31     }
32     
33     return 0;
34 }
35 

posted @ 2008-06-05 09:56 superman 閱讀(298) | 評論 (0)編輯 收藏

 1 /* Accepted 1008K 579MS G++ 1655B */
 2 #include <iostream>
 3 
 4 using namespace std;
 5 
 6 const int maxn = 50000;
 7 
 8 int main()
 9 {
10     int n, m;
11     int x[maxn + 1];
12     int l[maxn + 1], r[maxn + 1];
13 
14     scanf("%d"&m);
15     while(m--)
16     {
17         scanf("%d"&n);
18         bool AllNegative = true;
19         for(int i = 1; i <= n; i++)
20         {
21             scanf("%d", x + i);
22             if(x[i] > 0)
23                 AllNegative = false;
24         }
25         if(n == 2)
26         {
27             cout << x[1+ x[2<< endl; continue;
28         }
29         if(AllNegative)
30         {
31             int max = INT_MIN, a, b;
32             for(int i = 1; i <= n; i++)
33                 if(x[i] > max)
34                 {
35                     max = x[i];
36                     a = i;
37                 }
38             max = INT_MIN;
39             for(int i = 1; i <= n; i++)
40                 if(x[i] > max && i != a)
41                 {
42                     max = x[i];
43                     b = i;
44                 }
45             cout << x[a] + x[b] << endl;
46             continue;
47         }
48         
49         int max, sum;
50         
51         max = sum = 0;
52         for(int i = 1; i <= n; i++)
53         {
54             sum += x[i];
55             max >?= sum;
56             sum >?= 0;
57             l[i] = max;
58         }
59         
60         max = sum = 0;
61         for(int i = n; i >= 1; i--)
62         {
63             sum += x[i];
64             max >?= sum;
65             sum >?= 0;
66             r[i] = max;
67         }
68         
69         int ans = 0;
70         for(int i = 1; i <= n - 1; i++)
71             ans >?= (l[i] + r[i + 1]);
72         
73         printf("%d\n", ans);
74     }
75     
76     return 0;
77 }
78 

posted @ 2008-06-04 16:10 superman 閱讀(776) | 評論 (0)編輯 收藏

 1 /* Accepted 1180 C++ 00:01.39 1816K */
 2 #include <iostream>
 3 
 4 using namespace std;
 5 
 6 int main()
 7 {
 8     bool x[1000001= { false };
 9     for(int i = 1; i <= 1000000; i++
10     {
11         int n = i, sum = i;
12         while(n)
13         {
14             sum += n % 10;
15             n /= 10;
16         }
17         if(sum <= 1000000)
18             x[sum] = true;
19     }
20     for (int i = 1; i <= 1000000; i++)
21         if(x[i] == false)
22             cout << i << endl;
23     
24     return 0;
25 }
26 

posted @ 2008-06-04 09:24 superman 閱讀(386) | 評論 (0)編輯 收藏

 1 /* Accepted 1284 C++ 00:00.01 836K */
 2 #include <iostream>
 3 
 4 using namespace std;
 5 
 6 int main()
 7 {
 8     int n;
 9     cout << "PERFECTION OUTPUT" << endl;
10     while(cin >> n && n)
11     {
12         int sum = 0;
13         for(int i = 1; i * 2 <= n; i++)
14             if(n % i == 0)
15                 sum += i;
16         printf("%5d  ", n);
17         if(sum == n)
18             cout << "PERFECT" << endl;
19         if(sum < n)
20             cout << "DEFICIENT" << endl;
21         if(sum > n)
22             cout << "ABUNDANT" << endl;
23     }
24     cout << "END OF OUTPUT" << endl;
25     
26     return 0;
27 }
28 

posted @ 2008-06-03 14:28 superman 閱讀(336) | 評論 (0)編輯 收藏

  1 /* Accepted 1224 C++ 00:00.01 840K */
  2 #include <iostream>
  3 
  4 using namespace std;
  5 
  6 int main()
  7 {
  8     int n;
  9     int HIT[56= { 0 };
 10     int ERR[56= { 0 };
 11     int DIG[56= { 0 };
 12     int KILL[56= { 0 };
 13     int BLOCK[56= { 0 };
 14     int GAMES[56= { 0 };
 15      
 16     char key;
 17     int GameCount = 0;
 18     int CurrentPlayerNumber;
 19     while(cin >> key)
 20     {
 21         if(key == 'C')
 22         {
 23             cin >> n;
 24             for(int i = 0; i < n; i++)
 25             {
 26                 cin >> CurrentPlayerNumber;
 27                 GAMES[CurrentPlayerNumber]++;
 28             }
 29             GameCount++;
 30             continue;
 31         }
 32         if(key == 'H')
 33         {
 34             cin >> CurrentPlayerNumber;
 35             HIT[CurrentPlayerNumber]++;
 36             continue;
 37         }
 38         if(key == 'K')
 39         {
 40             cin >> CurrentPlayerNumber;
 41             KILL[CurrentPlayerNumber]++;
 42             continue;
 43         }
 44         if(key == 'E')
 45         {
 46             cin >> CurrentPlayerNumber;
 47             ERR[CurrentPlayerNumber]++;
 48             continue;
 49         }
 50         if(key == 'B')
 51         {
 52             cin >> CurrentPlayerNumber;
 53             BLOCK[CurrentPlayerNumber]++;
 54             continue;
 55         }
 56         if(key == 'D')
 57         {
 58             cin >> CurrentPlayerNumber;
 59             DIG[CurrentPlayerNumber]++;
 60             continue;
 61         }
 62         //key == 'R'
 63         cout << "Player  Hit Pct    KPG      BPG      DPG" << endl;
 64         cout << "-----------------------------------------" << endl;
 65         
 66         for(int i = 0; i <= 55; i++)
 67             if(GAMES[i])
 68             {
 69                 double HitPct = 0.0;
 70                 if(KILL[i] + ERR[i] + HIT[i])
 71                     HitPct = double(KILL[i] - ERR[i]) / (KILL[i] + ERR[i] + HIT[i]);
 72                 double KPG = double(KILL[i]) / GAMES[i];
 73                 double BPG = double(BLOCK[i]) / GAMES[i];
 74                 double DPG = double(DIG[i]) / GAMES[i];
 75                 
 76                 printf("%02d      %+5.3f  % 7.3f  % 7.3f  % 7.3f", i, HitPct, KPG, BPG, DPG); 
 77                 cout << endl;
 78             }
 79         
 80         int SumBLOCK = 0;
 81         int SumKILL = 0;
 82         int SumERR = 0
 83         int SumDIG = 0;
 84         int SumHIT = 0;
 85         
 86         for(int i = 0; i <= 55; i++)
 87             if(GAMES[i])
 88             {
 89                 SumBLOCK += BLOCK[i];
 90                 SumKILL += KILL[i];
 91                 SumERR += ERR[i];
 92                 SumDIG += DIG[i];
 93                 SumHIT += HIT[i];
 94             }
 95         double HitPct = 0.0;
 96         if(SumKILL + SumERR + SumHIT)
 97             HitPct = double(SumKILL - SumERR) / (SumKILL + SumERR + SumHIT);
 98         double KPG = double(SumKILL) / GameCount;
 99         double BPG = double(SumBLOCK) / GameCount;
100         double DPG = double(SumDIG) / GameCount;
101         
102         printf("team    %+5.3f  % 7.3f  % 7.3f  % 7.3f", HitPct, KPG, BPG, DPG); 
103         cout << endl << endl; 
104         
105         memset(HIT, 0sizeof(HIT));
106         memset(ERR, 0sizeof(ERR));
107         memset(DIG, 0sizeof(DIG));
108         memset(KILL, 0sizeof(KILL));
109         memset(BLOCK, 0sizeof(BLOCK));
110         memset(GAMES, 0sizeof(GAMES));
111         
112         GameCount = 0;
113     }
114     
115     return 0;
116 }
117 

posted @ 2008-06-03 09:53 superman 閱讀(386) | 評論 (0)編輯 收藏

 1 /* Accepted 1201 C++ 00:00.00 836K */
 2 #include <iostream>
 3 
 4 using namespace std;
 5 
 6 int main()
 7 {
 8     int n, x[100];
 9     
10     while(cin >> n && n)
11     {
12         char operation;
13         cin >> operation;
14         for(int i = 1; i <= n; i += 1)
15             cin >> x[i];
16         int ans[100= { 0 };
17         if(operation == 'P')
18         {
19             int pos[100];
20             for(int i = 1; i <= n; i++)
21                 pos[x[i]] = i;
22             
23             for(int i = 1; i <= n; i++)
24                 for(int j = 1; j < pos[i]; j++)
25                     if(x[j] > i)
26                         ans[i]++;
27         }
28         if(operation == 'I')
29         {
30             for(int i = 1; i <= n; i++)
31             {
32                 int cnt = 0, j = 1;
33                 while(true)
34                 {
35                     if(ans[j] == 0)
36                         cnt++;
37                     if(cnt == x[i] + 1)
38                         break;
39                     j++;
40                 }
41                 ans[j] = i;
42             }
43         }
44         for(int i = 1; i <= n; i++)
45             cout << ans[i] << (i == n ? '\n' : ' ');
46     }
47     
48     return 0;
49 }
50 

posted @ 2008-06-02 22:02 superman 閱讀(716) | 評論 (3)編輯 收藏

 1 /* Accepted 1268 C++ 00:00.00 840K */
 2 #include <iostream>
 3 
 4 using namespace std;
 5 
 6 int main()
 7 {
 8     int s, t, c = 1;
 9     while(true)
10     {
11         cin >> s >> t;
12         if(s == -1 && t == -1)
13             break;
14         
15         cout << "Case " << c++;
16         
17         if(s == 0 && t == 0)
18         {
19             cout << " is a tree." << endl;
20             continue;
21         }
22         
23         int cnt[2008= { 0 };
24         bool x[2008= { false };
25         
26         x[s] = x[t] = true;
27         int max = 0;
28         max >?= s;
29         max >?= t;
30         
31         cnt[t]++;
32         while(cin >> s >> t && s && t)
33             cnt[t]++, max >?= s, max >?= t, x[s] = x[t] = true;
34         
35         //count the number of roots
36         int rootCnt = 0;
37         for(int i = 1; i <= max; i++)
38             if(x[i] && cnt[i] == 0)
39                 rootCnt++;
40         if(rootCnt != 1)
41         {
42             cout << " is not a tree." << endl;
43             continue;
44         }
45         
46         //check if each node has only one parent
47         int i;
48         for(i = 1; i <= max; i++)
49             if(x[i] && cnt[i] > 1)
50                 break;
51         if(i <= max)
52         {
53             cout << " is not a tree." << endl;
54             continue;
55         }
56         
57         cout << " is a tree." << endl;
58     }
59     
60     return 0;
61 }
62 

posted @ 2008-06-02 09:57 superman 閱讀(338) | 評論 (0)編輯 收藏

 1 /* Accepted 1259 C++ 00:00.10 848K */
 2 #include <stack>
 3 #include <iostream>
 4 
 5 using namespace std;
 6 
 7 int main()
 8 {
 9     int n, s[1001];
10     while(scanf("%d"&n) && n)
11         while(true)
12         {
13             scanf("%d", s + 1);
14             if(s[1== 0)
15             {
16                 cout << endl; break;
17             }
18             for(int i = 2; i <= n; i++)
19                 scanf("%d", s + i);
20             
21             stack <int> st;
22             
23             int lp = 1, rp = 1;
24             while(lp <= n)
25             {
26                 if(rp <= n && s[lp] == rp)
27                 {
28                     lp++, rp++continue;
29                 }
30                 if(st.empty())
31                 {
32                     if(rp < n)
33                         st.push(rp++);
34                     else
35                     {
36                         cout << "No"goto over;
37                     }
38                 }
39                 else
40                 {
41                     if(s[lp] == st.top())
42                     {
43                         lp++; st.pop();
44                     }
45                     else
46                     {
47                         if(rp < n)
48                             st.push(rp++);
49                         else
50                         {
51                             cout << "No"goto over;
52                         }
53                     }
54                 }
55             }
56             cout << "Yes";
57             over:
58                 cout << endl;
59         }
60     
61     return 0;
62 }
63 

posted @ 2008-06-01 16:52 superman 閱讀(428) | 評論 (0)編輯 收藏

 1 /* Accepted 1251 C++ 00:00.00 832K */
 2 #include <iostream>
 3 
 4 using namespace std;
 5 
 6 int main()
 7 {
 8     int n, h[50], c = 1;
 9     
10     while(cin >> n && n)
11     {
12         int sum = 0;
13         for(int i = 0; i < n; i++)
14         {
15             cin >> h[i];
16             sum += h[i];
17         }
18         sum /= n;
19         int ans = 0;
20         for(int i = 0; i < n; i++)
21             ans += abs(h[i] - sum);
22         ans /= 2;
23         cout << "Set #" << c++ << endl
24              << "The minimum number of moves is " << ans << '.'
25              << endl << endl;
26     }
27     
28     return 0;
29 }
30 

posted @ 2008-06-01 13:52 superman 閱讀(472) | 評論 (1)編輯 收藏

僅列出標題
共19頁: First 4 5 6 7 8 9 10 11 12 Last 
青青草原综合久久大伊人导航_色综合久久天天综合_日日噜噜夜夜狠狠久久丁香五月_热久久这里只有精品
  • <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>
            亚洲电影免费在线| 亚洲最快最全在线视频| 在线观看成人一级片| 国产亚洲精品aa| 国产在线拍偷自揄拍精品| 狠狠综合久久av一区二区小说| 国产美女精品视频免费观看| 国产一二三精品| 亚洲韩国精品一区| 一区二区三区欧美亚洲| 中文一区二区在线观看| 亚洲欧美在线看| 久久伊人亚洲| 亚洲人体偷拍| 亚洲亚洲精品三区日韩精品在线视频 | 你懂的亚洲视频| 欧美成人在线网站| 国产麻豆综合| 99国产精品久久久久久久久久 | 久久免费的精品国产v∧| 麻豆精品视频在线观看| 亚洲色图制服丝袜| 亚洲理论在线观看| 久久国内精品自在自线400部| 欧美成人有码| 亚洲影院污污.| 久久综合伊人77777| 国产精品久久影院| 亚洲国产精品一区二区第一页 | 欧美一区二区性| 91久久国产综合久久| 午夜在线视频一区二区区别| 欧美日韩国产首页在线观看| 在线观看国产欧美| 性欧美1819性猛交| 日韩亚洲欧美成人一区| 免费不卡亚洲欧美| 国产一区二区观看| 亚洲欧美国产高清| 亚洲欧洲在线视频| 久久亚洲一区二区三区四区| 亚洲午夜一二三区视频| 永久免费视频成人| 一本一本久久a久久精品综合妖精 一本一本久久a久久精品综合麻豆 | 日韩亚洲视频在线| 欧美1区2区3区| 国产一区99| 亚洲欧美电影院| 99国产精品视频免费观看| 麻豆精品国产91久久久久久| 国产日韩欧美在线一区| 欧美在线观看网址综合| 亚洲无毛电影| 欧美日韩直播| 亚洲综合成人在线| 9l视频自拍蝌蚪9l视频成人| 欧美日韩国产综合视频在线| 亚洲精品免费网站| 欧美高潮视频| 美女视频黄免费的久久| 亚洲国产精品免费| 亚洲韩日在线| 欧美日韩中文在线| 亚洲一区二区三区中文字幕在线| 99视频超级精品| 国产精品久久网站| 久久精品视频在线| 久久夜色精品国产欧美乱| 亚洲国产婷婷香蕉久久久久久| 久久人人爽国产| 玖玖视频精品| 亚洲精品免费看| 一区二区三区精密机械公司| 国产精品高潮视频| 久久精品一区蜜桃臀影院| 久久国产欧美精品| 亚洲精品免费看| 亚洲性感激情| 永久久久久久| 亚洲精品看片| 国产精品毛片在线看| 久久免费视频网站| 欧美成人性网| 欧美一区二区精美| 嫩草影视亚洲| 午夜欧美不卡精品aaaaa| 欧美在线高清视频| 亚洲精品一区中文| 亚洲欧美视频一区二区三区| 亚洲丁香婷深爱综合| 99v久久综合狠狠综合久久| 国产精品欧美一区喷水| 免费看的黄色欧美网站| 欧美视频一区二区| 欧美成人dvd在线视频| 国产精品r级在线| 欧美 亚欧 日韩视频在线| 欧美三级视频在线播放| 老司机一区二区三区| 国产视频精品网| 亚洲在线观看视频| 亚洲欧洲另类国产综合| 夜夜嗨av一区二区三区中文字幕| 国产日韩欧美不卡在线| 欧美激情自拍| 国产亚洲欧美激情| 亚洲理伦电影| 91久久久在线| 久久久www成人免费无遮挡大片| 99国产精品久久久久久久成人热 | 免费国产一区二区| 国产精品99免视看9| 亚洲第一福利视频| 韩国三级电影久久久久久| 亚洲图中文字幕| 中文国产成人精品| 欧美国产日韩精品免费观看| 久久一区二区三区av| 国产免费一区二区三区香蕉精| 亚洲精品视频在线播放| 亚洲人www| 美女主播视频一区| 欧美国产第一页| …久久精品99久久香蕉国产| 亚洲欧美日韩在线一区| 亚洲自拍三区| 欧美日韩影院| 日韩天堂在线视频| 亚洲乱码精品一二三四区日韩在线| 久久国产视频网站| 久久精品水蜜桃av综合天堂| 国产精品久久中文| 亚洲影院一区| 午夜天堂精品久久久久| 国产精品v片在线观看不卡 | 亚洲免费电影在线| 一本色道久久综合狠狠躁的推荐| 你懂的国产精品永久在线| 欧美高清在线一区二区| 亚洲第一级黄色片| 欧美1区免费| 91久久极品少妇xxxxⅹ软件| 亚洲精品一区二区三区av| 欧美欧美全黄| 宅男66日本亚洲欧美视频| 午夜在线精品偷拍| 国产精品视频内| 欧美一级一区| 蜜桃av噜噜一区| 亚洲精品国产日韩| 欧美日韩国产成人在线91| 一区二区欧美国产| 久久精品99国产精品日本| 怡红院精品视频| 欧美高清在线视频| 一区二区欧美在线| 久久乐国产精品| 亚洲精品人人| 国产精品男女猛烈高潮激情| 欧美一级片在线播放| 久久精品av麻豆的观看方式 | 免费成人美女女| 久久青青草综合| 亚洲欧美日韩高清| 欧美日韩免费观看一区三区 | 久久激情视频久久| 亚洲国产精品尤物yw在线观看| 欧美二区在线| 在线亚洲国产精品网站| 久久五月天婷婷| 一区二区三区视频免费在线观看| 国产精品入口日韩视频大尺度| 欧美在线观看网站| 免播放器亚洲一区| 亚洲毛片一区二区| 欧美日韩精品一区二区天天拍小说 | 亚洲一区二区三区四区五区黄| 国产精品稀缺呦系列在线| 久久久一区二区三区| 亚洲巨乳在线| 久久亚洲午夜电影| 一区二区不卡在线视频 午夜欧美不卡在 | 午夜精品成人在线| 在线电影院国产精品| 国产精品成人在线| 蜜乳av另类精品一区二区| 亚洲午夜精品在线| 亚洲狠狠婷婷| 美女主播一区| 久久成人国产精品| 亚洲一级黄色av| 亚洲精品在线电影| 在线免费观看欧美| 国产一区999| 国产精品普通话对白| 欧美日韩一区二区在线观看| 美国成人直播| 久久久蜜桃精品| 久久电影一区| 欧美一级专区免费大片|