锘??xml version="1.0" encoding="utf-8" standalone="yes"?>日韩乱码人妻无码中文字幕久久,精品久久久久久无码专区不卡,91亚洲国产成人久久精品http://www.shnenglu.com/worm/涓轟粈涔堟垜鐨勭溂閲岄ケ鍚唱姘達紵鍥犱負鎴戠▼搴忔病鍐欏畬錛?/description>zh-cnWed, 07 May 2025 03:46:30 GMTWed, 07 May 2025 03:46:30 GMT60poj 3414瑙i鎶ュ憡(騫挎悳棰?http://www.shnenglu.com/worm/archive/2009/03/08/75917.htmlWORMWORMSun, 08 Mar 2009 10:40:00 GMThttp://www.shnenglu.com/worm/archive/2009/03/08/75917.htmlhttp://www.shnenglu.com/worm/comments/75917.htmlhttp://www.shnenglu.com/worm/archive/2009/03/08/75917.html#Feedback5http://www.shnenglu.com/worm/comments/commentRss/75917.htmlhttp://www.shnenglu.com/worm/services/trackbacks/75917.html闃呰鍏ㄦ枃

WORM 2009-03-08 18:40 鍙戣〃璇勮
]]>
poj 3191瑙i鎶ュ憡http://www.shnenglu.com/worm/archive/2009/03/08/75887.htmlWORMWORMSun, 08 Mar 2009 04:37:00 GMThttp://www.shnenglu.com/worm/archive/2009/03/08/75887.htmlhttp://www.shnenglu.com/worm/comments/75887.htmlhttp://www.shnenglu.com/worm/archive/2009/03/08/75887.html#Feedback1http://www.shnenglu.com/worm/comments/commentRss/75887.htmlhttp://www.shnenglu.com/worm/services/trackbacks/75887.htmlThe Moronic Cowmpouter
Time Limit: 1000MS Memory Limit: 65536K
Total Submissions: 1344 Accepted: 676

Description

Inexperienced in the digital arts, the cows tried to build a calculating engine (yes, it's a cowmpouter) using binary numbers (base 2) but instead built one based on base negative 2! They were quite pleased since numbers expressed in base −2 do not have a sign bit.

You know number bases have place values that start at 1 (base to the 0 power) and proceed right-to-left to base^1, base^2, and so on. In base −2, the place values are 1, −2, 4, −8, 16, −32, ... (reading from right to left). Thus, counting from 1 goes like this: 1, 110, 111, 100, 101, 11010, 11011, 11000, 11001, and so on.

Eerily, negative numbers are also represented with 1's and 0's but no sign. Consider counting from −1 downward: 11, 10, 1101, 1100, 1111, and so on.

Please help the cows convert ordinary decimal integers (range -2,000,000,000..2,000,000,000) to their counterpart representation in base −2.

Input

Line 1: A single integer to be converted to base −2

Output

Line 1: A single integer with no leading zeroes that is the input integer converted to base −2. The value 0 is expressed as 0, with exactly one 0.

Sample Input

-13

Sample Output

110111

Hint

Explanation of the sample:

Reading from right-to-left:
1*1 + 1*-2 + 1*4 + 0*-8 +1*16 + 1*-32 = -13
 棰樼洰鐨勬剰鎬濆氨鏄浣犳妸涓涓暟杞崲涓?2榪涘埗錛?br>鍩烘湰鍘熺悊:
               濡傛灉n涓哄鏁幫紝閭d箞鏈綅鑲畾涓?錛屽洜姝ゅ氨鍙互杞負姹?x-1)/-2 鐨勫瓙闂浜嗭紒 錛堥櫎浠?2鍙互綾繪瘮鍗佽繘鍒跺氨鑳界悊瑙d簡錛?br>               濡傛灉n涓哄伓鏁幫紝鏈綅蹇呬負0錛岀劧鍚庡啀杞負姹倄/-2鐨勫瓙闂錛?br>緇撴潫鏉′歡褰?n=1銆?br>鎬濊礬寰堢畝鍗曪紝浣嗘槸鏈変袱涓皬鏂歸潰瑕佹彁鎻愶紝涓瀹氳鑰冭檻n=0鐨勬儏鍐碉紝鎴戝氨鏄病鑰冭檻鑰屼竴鐩磋秴鏃訛紝閮侀椃錛岃繕鎵句笉鍑洪敊璇紝闄峰叆浜嗘寰幆鎬笉寰楄秴鏃訛紝榪樻湁娉ㄦ剰鐞冪殑緇撴灉鏄嗗簭鐨勶紒錛佸懙鍛典笅闈㈡槸浠g爜錛?br>
 1//============================================================================
 2// Name        : poj 3191.cpp
 3// Author      : worm
 4// Copyright   : Your copyright notice
 5// Description :鎶婁竴涓崄榪涘埗鐨勬暟杞崲涓?2榪涘埗鐨勬暟
 6//============================================================================
 7
 8#include <iostream>
 9#include <stdio.h>
10#include <string>
11#include <math.h>
12using namespace std;
13string a= "";
14int main() {
15    int x;
16    cin >> x;
17    if (x == 0{
18        cout <<"0"<<endl;
19        return 0;
20    }

21
22    while (x != 1{
23        if (abs(x) % 2 == 1{
24            a += '1';
25            x = (x-1)/-2;
26            continue;
27        }

28        a += '0';
29        x /= -2;
30    }

31    cout <<"1";
32    for (int i = a.length() - 1; i >= 0; i--{
33        printf("%c",a[i]);
34    }

35
36    return 0;
37}

38


WORM 2009-03-08 12:37 鍙戣〃璇勮
]]>
poj 3126 Prim Path 絎竴閬揃FShttp://www.shnenglu.com/worm/archive/2009/03/08/75880.htmlWORMWORMSun, 08 Mar 2009 02:36:00 GMThttp://www.shnenglu.com/worm/archive/2009/03/08/75880.htmlhttp://www.shnenglu.com/worm/comments/75880.htmlhttp://www.shnenglu.com/worm/archive/2009/03/08/75880.html#Feedback1http://www.shnenglu.com/worm/comments/commentRss/75880.htmlhttp://www.shnenglu.com/worm/services/trackbacks/75880.html鎸虹畝鍗曪紝鐪嬩唬鐮佸簲璇ュ彲浠ョ湅鎳傦紝涓嬮潰鏄唬鐮?
9#include <iostream>
10#include <queue>
11#include <math.h>
12using namespace std;
13int a, b;
14int p[9999= 0 };
15int visited[9999= 0 };
16bool isprime(int x) {
17
18    for (int i = 2; i <= sqrt((double) x); ++i) {
19        if (x % i == 0)
20            return false;
21    }

22    return true;
23}

24int BFS(int s, int r) {
25    queue<int> q;
26    q.push(s);
27    p[s] = 0;
28    visited[s] = 1;
29    while (!q.empty()) {
30        int temp = q.front();
31        q.pop();
32        for (int i = 0; i <= 9; i++{
33            int y1 = (temp / 10* 10 + i;
34            if (isprime(y1) && !visited[y1]) {
35                q.push(y1);
36                p[y1] = p[temp] + 1;
37                visited[y1] = 1;
38            }

39            int y2 = temp % 10 + (temp / 100* 100 + i * 10;
40            if (isprime(y2) && !visited[y2]) {
41                q.push(y2);
42                p[y2] = p[temp] + 1;
43                visited[y2] = 1;
44            }

45            int y3 = temp % 100 + (temp / 1000* 1000 + 100 * i;
46            if (isprime(y3) && !visited[y3]) {
47                q.push(y3);
48                p[y3] = p[temp] + 1;
49                visited[y3] = 1;
50            }

51            if (i != 0{
52                int y4 = temp % 1000 + i * 1000;
53                if (isprime(y4) && !visited[y4]) {
54                    q.push(y4);
55                    p[y4] = p[temp] + 1;
56                    visited[y4] = 1;
57                }

58            }

59            if (visited[r])
60                return p[r];
61        }

62
63    }

64    return 0;
65}

66int main() {
67    int n;
68    cin >> n;
69    while (n--{
70        memset(visited,0,sizeof(visited));
71        memset(p,0,sizeof(p));
72        cin >> a >> b;
73        cout << BFS(a, b) << endl;
74
75    }

76    return 0;
77}

78


WORM 2009-03-08 10:36 鍙戣〃璇勮
]]>
絎竴閬撳箍搴︽悳绱FS綰康 poj 3278 婧愪唬鐮?/title><link>http://www.shnenglu.com/worm/archive/2009/03/07/75838.html</link><dc:creator>WORM</dc:creator><author>WORM</author><pubDate>Sat, 07 Mar 2009 10:31:00 GMT</pubDate><guid>http://www.shnenglu.com/worm/archive/2009/03/07/75838.html</guid><wfw:comment>http://www.shnenglu.com/worm/comments/75838.html</wfw:comment><comments>http://www.shnenglu.com/worm/archive/2009/03/07/75838.html#Feedback</comments><slash:comments>3</slash:comments><wfw:commentRss>http://www.shnenglu.com/worm/comments/commentRss/75838.html</wfw:commentRss><trackback:ping>http://www.shnenglu.com/worm/services/trackbacks/75838.html</trackback:ping><description><![CDATA[   鍙傝冧簡鍒漢鐨勬濊礬錛屽仛鍑轟簡絎竴閬揃FS錛岃櫧鐒跺湪澶х墰浠湅鏉ヤ笉灞戜竴欏?but about me,I really happy for it, I'm coming ! worm never give up!!<br> <div style="BORDER-RIGHT: #cccccc 1px solid; PADDING-RIGHT: 5px; BORDER-TOP: #cccccc 1px solid; PADDING-LEFT: 4px; FONT-SIZE: 13px; PADDING-BOTTOM: 4px; BORDER-LEFT: #cccccc 1px solid; WIDTH: 98%; WORD-BREAK: break-all; PADDING-TOP: 4px; BORDER-BOTTOM: #cccccc 1px solid; BACKGROUND-COLOR: #eeeeee"><span style="COLOR: #008080"> 1</span><img src="http://www.shnenglu.com/Images/OutliningIndicators/None.gif" align=top><span style="COLOR: #008000">//</span><span style="COLOR: #008000">============================================================================<br></span><span style="COLOR: #008080"> 2</span><span style="COLOR: #008000"><img src="http://www.shnenglu.com/Images/OutliningIndicators/None.gif" align=top></span><span style="COLOR: #008000">//</span><span style="COLOR: #008000"> Name        : poj.cpp<br></span><span style="COLOR: #008080"> 3</span><span style="COLOR: #008000"><img src="http://www.shnenglu.com/Images/OutliningIndicators/None.gif" align=top></span><span style="COLOR: #008000">//</span><span style="COLOR: #008000"> Author      :<br></span><span style="COLOR: #008080"> 4</span><span style="COLOR: #008000"><img src="http://www.shnenglu.com/Images/OutliningIndicators/None.gif" align=top></span><span style="COLOR: #008000">//</span><span style="COLOR: #008000"> Version     :<br></span><span style="COLOR: #008080"> 5</span><span style="COLOR: #008000"><img src="http://www.shnenglu.com/Images/OutliningIndicators/None.gif" align=top></span><span style="COLOR: #008000">//</span><span style="COLOR: #008000"> Copyright   : Your copyright notice<br></span><span style="COLOR: #008080"> 6</span><span style="COLOR: #008000"><img src="http://www.shnenglu.com/Images/OutliningIndicators/None.gif" align=top></span><span style="COLOR: #008000">//</span><span style="COLOR: #008000"> Description : Hello World in C++, Ansi-style<br></span><span style="COLOR: #008080"> 7</span><span style="COLOR: #008000"><img src="http://www.shnenglu.com/Images/OutliningIndicators/None.gif" align=top></span><span style="COLOR: #008000">//</span><span style="COLOR: #008000">============================================================================</span><span style="COLOR: #008000"><br></span><span style="COLOR: #008080"> 8</span><span style="COLOR: #008000"><img src="http://www.shnenglu.com/Images/OutliningIndicators/None.gif" align=top></span><span style="COLOR: #000000"><br></span><span style="COLOR: #008080"> 9</span><span style="COLOR: #000000"><img src="http://www.shnenglu.com/Images/OutliningIndicators/None.gif" align=top>#include </span><span style="COLOR: #000000"><</span><span style="COLOR: #000000">iostream</span><span style="COLOR: #000000">></span><span style="COLOR: #000000"><br></span><span style="COLOR: #008080">10</span><span style="COLOR: #000000"><img src="http://www.shnenglu.com/Images/OutliningIndicators/None.gif" align=top>#include </span><span style="COLOR: #000000"><</span><span style="COLOR: #000000">queue</span><span style="COLOR: #000000">></span><span style="COLOR: #000000"><br></span><span style="COLOR: #008080">11</span><span style="COLOR: #000000"><img src="http://www.shnenglu.com/Images/OutliningIndicators/None.gif" align=top></span><span style="COLOR: #0000ff">using</span><span style="COLOR: #000000"> </span><span style="COLOR: #0000ff">namespace</span><span style="COLOR: #000000"> std;<br></span><span style="COLOR: #008080">12</span><span style="COLOR: #000000"><img src="http://www.shnenglu.com/Images/OutliningIndicators/None.gif" align=top>queue</span><span style="COLOR: #000000"><</span><span style="COLOR: #0000ff">int</span><span style="COLOR: #000000">></span><span style="COLOR: #000000"> q;<br></span><span style="COLOR: #008080">13</span><span style="COLOR: #000000"><img src="http://www.shnenglu.com/Images/OutliningIndicators/None.gif" align=top></span><span style="COLOR: #0000ff">int</span><span style="COLOR: #000000">    result[</span><span style="COLOR: #000000">100001</span><span style="COLOR: #000000">];<br></span><span style="COLOR: #008080">14</span><span style="COLOR: #000000"><img id=Codehighlighter1_419_421_Open_Image onclick="this.style.display='none'; Codehighlighter1_419_421_Open_Text.style.display='none'; Codehighlighter1_419_421_Closed_Image.style.display='inline'; Codehighlighter1_419_421_Closed_Text.style.display='inline';" src="http://www.shnenglu.com/Images/OutliningIndicators/ExpandedBlockStart.gif" align=top><img id=Codehighlighter1_419_421_Closed_Image style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_419_421_Closed_Text.style.display='none'; Codehighlighter1_419_421_Open_Image.style.display='inline'; Codehighlighter1_419_421_Open_Text.style.display='inline';" src="http://www.shnenglu.com/Images/OutliningIndicators/ContractedBlock.gif" align=top></span><span style="COLOR: #0000ff">int</span><span style="COLOR: #000000"> visited[</span><span style="COLOR: #000000">100001</span><span style="COLOR: #000000">] </span><span style="COLOR: #000000">=</span><span style="COLOR: #000000"> </span><span id=Codehighlighter1_419_421_Closed_Text style="BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; DISPLAY: none; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 1px solid; BACKGROUND-COLOR: #ffffff"><img src="http://www.shnenglu.com/Images/dot.gif"></span><span id=Codehighlighter1_419_421_Open_Text><span style="COLOR: #000000">{</span><span style="COLOR: #000000">0</span><span style="COLOR: #000000">}</span></span><span style="COLOR: #000000">;<br></span><span style="COLOR: #008080">15</span><span style="COLOR: #000000"><img id=Codehighlighter1_451_976_Open_Image onclick="this.style.display='none'; Codehighlighter1_451_976_Open_Text.style.display='none'; Codehighlighter1_451_976_Closed_Image.style.display='inline'; Codehighlighter1_451_976_Closed_Text.style.display='inline';" src="http://www.shnenglu.com/Images/OutliningIndicators/ExpandedBlockStart.gif" align=top><img id=Codehighlighter1_451_976_Closed_Image style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_451_976_Closed_Text.style.display='none'; Codehighlighter1_451_976_Open_Image.style.display='inline'; Codehighlighter1_451_976_Open_Text.style.display='inline';" src="http://www.shnenglu.com/Images/OutliningIndicators/ContractedBlock.gif" align=top></span><span style="COLOR: #0000ff">int</span><span style="COLOR: #000000"> BFS(</span><span style="COLOR: #0000ff">int</span><span style="COLOR: #000000"> start,</span><span style="COLOR: #0000ff">int</span><span style="COLOR: #000000"> end) </span><span id=Codehighlighter1_451_976_Closed_Text style="BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; DISPLAY: none; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 1px solid; BACKGROUND-COLOR: #ffffff"><img src="http://www.shnenglu.com/Images/dot.gif"></span><span id=Codehighlighter1_451_976_Open_Text><span style="COLOR: #000000">{<br></span><span style="COLOR: #008080">16</span><span style="COLOR: #000000"><img src="http://www.shnenglu.com/Images/OutliningIndicators/InBlock.gif" align=top>    </span><span style="COLOR: #0000ff">if</span><span style="COLOR: #000000"> (start </span><span style="COLOR: #000000">==</span><span style="COLOR: #000000"> end)<br></span><span style="COLOR: #008080">17</span><span style="COLOR: #000000"><img src="http://www.shnenglu.com/Images/OutliningIndicators/InBlock.gif" align=top>        </span><span style="COLOR: #0000ff">return</span><span style="COLOR: #000000"> </span><span style="COLOR: #000000">0</span><span style="COLOR: #000000">;<br></span><span style="COLOR: #008080">18</span><span style="COLOR: #000000"><img src="http://www.shnenglu.com/Images/OutliningIndicators/InBlock.gif" align=top>    q.push(start);<br></span><span style="COLOR: #008080">19</span><span style="COLOR: #000000"><img src="http://www.shnenglu.com/Images/OutliningIndicators/InBlock.gif" align=top>    result[start] </span><span style="COLOR: #000000">=</span><span style="COLOR: #000000"> </span><span style="COLOR: #000000">0</span><span style="COLOR: #000000">;<br></span><span style="COLOR: #008080">20</span><span style="COLOR: #000000"><img src="http://www.shnenglu.com/Images/OutliningIndicators/InBlock.gif" align=top>    visited[start] </span><span style="COLOR: #000000">=</span><span style="COLOR: #000000"> </span><span style="COLOR: #000000">1</span><span style="COLOR: #000000">;<br></span><span style="COLOR: #008080">21</span><span style="COLOR: #000000"><img id=Codehighlighter1_560_963_Open_Image onclick="this.style.display='none'; Codehighlighter1_560_963_Open_Text.style.display='none'; Codehighlighter1_560_963_Closed_Image.style.display='inline'; Codehighlighter1_560_963_Closed_Text.style.display='inline';" src="http://www.shnenglu.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif" align=top><img id=Codehighlighter1_560_963_Closed_Image style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_560_963_Closed_Text.style.display='none'; Codehighlighter1_560_963_Open_Image.style.display='inline'; Codehighlighter1_560_963_Open_Text.style.display='inline';" src="http://www.shnenglu.com/Images/OutliningIndicators/ContractedSubBlock.gif" align=top>    </span><span style="COLOR: #0000ff">while</span><span style="COLOR: #000000">(</span><span style="COLOR: #000000">!</span><span style="COLOR: #000000">q.empty()) </span><span id=Codehighlighter1_560_963_Closed_Text style="BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; DISPLAY: none; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 1px solid; BACKGROUND-COLOR: #ffffff"><img src="http://www.shnenglu.com/Images/dot.gif"></span><span id=Codehighlighter1_560_963_Open_Text><span style="COLOR: #000000">{<br></span><span style="COLOR: #008080">22</span><span style="COLOR: #000000"><img src="http://www.shnenglu.com/Images/OutliningIndicators/InBlock.gif" align=top>        </span><span style="COLOR: #0000ff">int</span><span style="COLOR: #000000"> temp </span><span style="COLOR: #000000">=</span><span style="COLOR: #000000"> q.front();<br></span><span style="COLOR: #008080">23</span><span style="COLOR: #000000"><img src="http://www.shnenglu.com/Images/OutliningIndicators/InBlock.gif" align=top>        q.pop();<br></span><span style="COLOR: #008080">24</span><span style="COLOR: #000000"><img src="http://www.shnenglu.com/Images/OutliningIndicators/InBlock.gif" align=top>        </span><span style="COLOR: #0000ff">int</span><span style="COLOR: #000000"> next;<br></span><span style="COLOR: #008080">25</span><span style="COLOR: #000000"><img id=Codehighlighter1_639_960_Open_Image onclick="this.style.display='none'; Codehighlighter1_639_960_Open_Text.style.display='none'; Codehighlighter1_639_960_Closed_Image.style.display='inline'; Codehighlighter1_639_960_Closed_Text.style.display='inline';" src="http://www.shnenglu.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif" align=top><img id=Codehighlighter1_639_960_Closed_Image style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_639_960_Closed_Text.style.display='none'; Codehighlighter1_639_960_Open_Image.style.display='inline'; Codehighlighter1_639_960_Open_Text.style.display='inline';" src="http://www.shnenglu.com/Images/OutliningIndicators/ContractedSubBlock.gif" align=top>        </span><span style="COLOR: #0000ff">for</span><span style="COLOR: #000000"> (</span><span style="COLOR: #0000ff">int</span><span style="COLOR: #000000"> i </span><span style="COLOR: #000000">=</span><span style="COLOR: #000000"> </span><span style="COLOR: #000000">0</span><span style="COLOR: #000000">; i </span><span style="COLOR: #000000"><</span><span style="COLOR: #000000"> </span><span style="COLOR: #000000">3</span><span style="COLOR: #000000">; </span><span style="COLOR: #000000">++</span><span style="COLOR: #000000">i) </span><span id=Codehighlighter1_639_960_Closed_Text style="BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; DISPLAY: none; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 1px solid; BACKGROUND-COLOR: #ffffff"><img src="http://www.shnenglu.com/Images/dot.gif"></span><span id=Codehighlighter1_639_960_Open_Text><span style="COLOR: #000000">{<br></span><span style="COLOR: #008080">26</span><span style="COLOR: #000000"><img src="http://www.shnenglu.com/Images/OutliningIndicators/InBlock.gif" align=top>            </span><span style="COLOR: #0000ff">if</span><span style="COLOR: #000000"> (i </span><span style="COLOR: #000000">==</span><span style="COLOR: #000000"> </span><span style="COLOR: #000000">0</span><span style="COLOR: #000000">)<br></span><span style="COLOR: #008080">27</span><span style="COLOR: #000000"><img src="http://www.shnenglu.com/Images/OutliningIndicators/InBlock.gif" align=top>                next </span><span style="COLOR: #000000">=</span><span style="COLOR: #000000"> temp </span><span style="COLOR: #000000">-</span><span style="COLOR: #000000"> </span><span style="COLOR: #000000">1</span><span style="COLOR: #000000">;<br></span><span style="COLOR: #008080">28</span><span style="COLOR: #000000"><img src="http://www.shnenglu.com/Images/OutliningIndicators/InBlock.gif" align=top>            </span><span style="COLOR: #0000ff">if</span><span style="COLOR: #000000"> (i </span><span style="COLOR: #000000">==</span><span style="COLOR: #000000"> </span><span style="COLOR: #000000">1</span><span style="COLOR: #000000">)<br></span><span style="COLOR: #008080">29</span><span style="COLOR: #000000"><img src="http://www.shnenglu.com/Images/OutliningIndicators/InBlock.gif" align=top>                next </span><span style="COLOR: #000000">=</span><span style="COLOR: #000000"> temp </span><span style="COLOR: #000000">+</span><span style="COLOR: #000000"> </span><span style="COLOR: #000000">1</span><span style="COLOR: #000000">;<br></span><span style="COLOR: #008080">30</span><span style="COLOR: #000000"><img src="http://www.shnenglu.com/Images/OutliningIndicators/InBlock.gif" align=top>            </span><span style="COLOR: #0000ff">if</span><span style="COLOR: #000000"> (i </span><span style="COLOR: #000000">==</span><span style="COLOR: #000000"> </span><span style="COLOR: #000000">2</span><span style="COLOR: #000000">)<br></span><span style="COLOR: #008080">31</span><span style="COLOR: #000000"><img src="http://www.shnenglu.com/Images/OutliningIndicators/InBlock.gif" align=top>                next </span><span style="COLOR: #000000">=</span><span style="COLOR: #000000"> temp</span><span style="COLOR: #000000">*</span><span style="COLOR: #000000">2</span><span style="COLOR: #000000">;<br></span><span style="COLOR: #008080">32</span><span style="COLOR: #000000"><img id=Codehighlighter1_780_799_Open_Image onclick="this.style.display='none'; Codehighlighter1_780_799_Open_Text.style.display='none'; Codehighlighter1_780_799_Closed_Image.style.display='inline'; Codehighlighter1_780_799_Closed_Text.style.display='inline';" src="http://www.shnenglu.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif" align=top><img id=Codehighlighter1_780_799_Closed_Image style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_780_799_Closed_Text.style.display='none'; Codehighlighter1_780_799_Open_Image.style.display='inline'; Codehighlighter1_780_799_Open_Text.style.display='inline';" src="http://www.shnenglu.com/Images/OutliningIndicators/ContractedSubBlock.gif" align=top>            </span><span style="COLOR: #0000ff">if</span><span style="COLOR: #000000">(next </span><span style="COLOR: #000000">></span><span style="COLOR: #000000"> </span><span style="COLOR: #000000">100000</span><span style="COLOR: #000000"> </span><span style="COLOR: #000000">||</span><span style="COLOR: #000000"> next </span><span style="COLOR: #000000"><</span><span style="COLOR: #000000"> </span><span style="COLOR: #000000">0</span><span style="COLOR: #000000">) </span><span id=Codehighlighter1_780_799_Closed_Text style="BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; DISPLAY: none; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 1px solid; BACKGROUND-COLOR: #ffffff"><img src="http://www.shnenglu.com/Images/dot.gif"></span><span id=Codehighlighter1_780_799_Open_Text><span style="COLOR: #000000">{<br></span><span style="COLOR: #008080">33</span><span style="COLOR: #000000"><img src="http://www.shnenglu.com/Images/OutliningIndicators/InBlock.gif" align=top>                </span><span style="COLOR: #0000ff">continue</span><span style="COLOR: #000000">;<br></span><span style="COLOR: #008080">34</span><span style="COLOR: #000000"><img src="http://www.shnenglu.com/Images/OutliningIndicators/ExpandedSubBlockEnd.gif" align=top>            }</span></span><span style="COLOR: #000000"><br></span><span style="COLOR: #008080">35</span><span style="COLOR: #000000"><img id=Codehighlighter1_828_911_Open_Image onclick="this.style.display='none'; Codehighlighter1_828_911_Open_Text.style.display='none'; Codehighlighter1_828_911_Closed_Image.style.display='inline'; Codehighlighter1_828_911_Closed_Text.style.display='inline';" src="http://www.shnenglu.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif" align=top><img id=Codehighlighter1_828_911_Closed_Image style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_828_911_Closed_Text.style.display='none'; Codehighlighter1_828_911_Open_Image.style.display='inline'; Codehighlighter1_828_911_Open_Text.style.display='inline';" src="http://www.shnenglu.com/Images/OutliningIndicators/ContractedSubBlock.gif" align=top>            </span><span style="COLOR: #0000ff">if</span><span style="COLOR: #000000"> (visited[next] </span><span style="COLOR: #000000">!=</span><span style="COLOR: #000000"> </span><span style="COLOR: #000000">1</span><span style="COLOR: #000000">) </span><span id=Codehighlighter1_828_911_Closed_Text style="BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; DISPLAY: none; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 1px solid; BACKGROUND-COLOR: #ffffff"><img src="http://www.shnenglu.com/Images/dot.gif"></span><span id=Codehighlighter1_828_911_Open_Text><span style="COLOR: #000000">{<br></span><span style="COLOR: #008080">36</span><span style="COLOR: #000000"><img src="http://www.shnenglu.com/Images/OutliningIndicators/InBlock.gif" align=top>                q.push(next);<br></span><span style="COLOR: #008080">37</span><span style="COLOR: #000000"><img src="http://www.shnenglu.com/Images/OutliningIndicators/InBlock.gif" align=top>                result[next] </span><span style="COLOR: #000000">=</span><span style="COLOR: #000000"> result[temp] </span><span style="COLOR: #000000">+</span><span style="COLOR: #000000"> </span><span style="COLOR: #000000">1</span><span style="COLOR: #000000">;<br></span><span style="COLOR: #008080">38</span><span style="COLOR: #000000"><img src="http://www.shnenglu.com/Images/OutliningIndicators/InBlock.gif" align=top>                visited[next] </span><span style="COLOR: #000000">=</span><span style="COLOR: #000000"> </span><span style="COLOR: #000000">1</span><span style="COLOR: #000000">;<br></span><span style="COLOR: #008080">39</span><span style="COLOR: #000000"><img src="http://www.shnenglu.com/Images/OutliningIndicators/ExpandedSubBlockEnd.gif" align=top>            }</span></span><span style="COLOR: #000000"><br></span><span style="COLOR: #008080">40</span><span style="COLOR: #000000"><img src="http://www.shnenglu.com/Images/OutliningIndicators/InBlock.gif" align=top>            </span><span style="COLOR: #0000ff">if</span><span style="COLOR: #000000"> (next </span><span style="COLOR: #000000">==</span><span style="COLOR: #000000"> end)<br></span><span style="COLOR: #008080">41</span><span style="COLOR: #000000"><img src="http://www.shnenglu.com/Images/OutliningIndicators/InBlock.gif" align=top>                </span><span style="COLOR: #0000ff">return</span><span style="COLOR: #000000"> result[next];<br></span><span style="COLOR: #008080">42</span><span style="COLOR: #000000"><img src="http://www.shnenglu.com/Images/OutliningIndicators/ExpandedSubBlockEnd.gif" align=top>        }</span></span><span style="COLOR: #000000"><br></span><span style="COLOR: #008080">43</span><span style="COLOR: #000000"><img src="http://www.shnenglu.com/Images/OutliningIndicators/ExpandedSubBlockEnd.gif" align=top>    }</span></span><span style="COLOR: #000000"><br></span><span style="COLOR: #008080">44</span><span style="COLOR: #000000"><img src="http://www.shnenglu.com/Images/OutliningIndicators/InBlock.gif" align=top>    </span><span style="COLOR: #0000ff">return</span><span style="COLOR: #000000"> </span><span style="COLOR: #000000">0</span><span style="COLOR: #000000">;<br></span><span style="COLOR: #008080">45</span><span style="COLOR: #000000"><img src="http://www.shnenglu.com/Images/OutliningIndicators/ExpandedBlockEnd.gif" align=top>}</span></span><span style="COLOR: #000000"><br></span><span style="COLOR: #008080">46</span><span style="COLOR: #000000"><img id=Codehighlighter1_989_1055_Open_Image onclick="this.style.display='none'; Codehighlighter1_989_1055_Open_Text.style.display='none'; Codehighlighter1_989_1055_Closed_Image.style.display='inline'; Codehighlighter1_989_1055_Closed_Text.style.display='inline';" src="http://www.shnenglu.com/Images/OutliningIndicators/ExpandedBlockStart.gif" align=top><img id=Codehighlighter1_989_1055_Closed_Image style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_989_1055_Closed_Text.style.display='none'; Codehighlighter1_989_1055_Open_Image.style.display='inline'; Codehighlighter1_989_1055_Open_Text.style.display='inline';" src="http://www.shnenglu.com/Images/OutliningIndicators/ContractedBlock.gif" align=top></span><span style="COLOR: #0000ff">int</span><span style="COLOR: #000000"> main() </span><span id=Codehighlighter1_989_1055_Closed_Text style="BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; DISPLAY: none; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 1px solid; BACKGROUND-COLOR: #ffffff"><img src="http://www.shnenglu.com/Images/dot.gif"></span><span id=Codehighlighter1_989_1055_Open_Text><span style="COLOR: #000000">{<br></span><span style="COLOR: #008080">47</span><span style="COLOR: #000000"><img src="http://www.shnenglu.com/Images/OutliningIndicators/InBlock.gif" align=top>    </span><span style="COLOR: #0000ff">int</span><span style="COLOR: #000000"> n,k;<br></span><span style="COLOR: #008080">48</span><span style="COLOR: #000000"><img src="http://www.shnenglu.com/Images/OutliningIndicators/InBlock.gif" align=top>    cin </span><span style="COLOR: #000000">>></span><span style="COLOR: #000000"> n </span><span style="COLOR: #000000">>></span><span style="COLOR: #000000"> k;<br></span><span style="COLOR: #008080">49</span><span style="COLOR: #000000"><img src="http://www.shnenglu.com/Images/OutliningIndicators/InBlock.gif" align=top>    cout </span><span style="COLOR: #000000"><<</span><span style="COLOR: #000000"> BFS(n,k) </span><span style="COLOR: #000000"><<</span><span style="COLOR: #000000"> endl;<br></span><span style="COLOR: #008080">50</span><span style="COLOR: #000000"><img src="http://www.shnenglu.com/Images/OutliningIndicators/InBlock.gif" align=top>    </span><span style="COLOR: #0000ff">return</span><span style="COLOR: #000000"> </span><span style="COLOR: #000000">0</span><span style="COLOR: #000000">;<br></span><span style="COLOR: #008080">51</span><span style="COLOR: #000000"><img src="http://www.shnenglu.com/Images/OutliningIndicators/ExpandedBlockEnd.gif" align=top>}</span></span><span style="COLOR: #000000"><br></span><span style="COLOR: #008080">52</span><span style="COLOR: #000000"><img src="http://www.shnenglu.com/Images/OutliningIndicators/None.gif" align=top></span></div> <img src ="http://www.shnenglu.com/worm/aggbug/75838.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.shnenglu.com/worm/" target="_blank">WORM</a> 2009-03-07 18:31 <a href="http://www.shnenglu.com/worm/archive/2009/03/07/75838.html#Feedback" target="_blank" style="text-decoration:none;">鍙戣〃璇勮</a></div>]]></description></item><item><title>poj 3705瑙i鎬濊礬鍙婃簮浠g爜http://www.shnenglu.com/worm/archive/2009/03/06/75700.htmlWORMWORMFri, 06 Mar 2009 00:52:00 GMThttp://www.shnenglu.com/worm/archive/2009/03/06/75700.htmlhttp://www.shnenglu.com/worm/comments/75700.htmlhttp://www.shnenglu.com/worm/archive/2009/03/06/75700.html#Feedback0http://www.shnenglu.com/worm/comments/commentRss/75700.htmlhttp://www.shnenglu.com/worm/services/trackbacks/75700.html 1//============================================================================
 2// Name        : poj.cpp
 3// Author      :
 4// Version     :
 5// Copyright   : Your copyright notice
 6// Description : 棰樼洰澶ф剰灝辨槸灝嗘搴忔暟鍒?,2,3,,n,閫氳繃鏈灝戠殑“澶嶅埗綺樿創”鏁?br> 7// 鍙樹負閫嗗簭搴忓垪鐨勯棶棰樸?br> 8//鍩烘湰鎬濇兂錛?nbsp; 濡傛灉n涓哄鏁幫紝鍋囪n = 7錛?br> 9// 1 2 3 4 5 6 7          灝唍宸﹁竟鐨勬渶涓棿鐨勪袱涓暟渚濇縐誨埌7鐨勫彸杈?br>10// 1 2 5 6 7 3 4       鐨勬渶涓棿
11// 1 6 7 3 2 5 4
12// 7 3 2 1 6 5 4          灝?nbsp;3 2 1涓?nbsp;6 5 4 浜ゆ崲
13// 7 6 5 4 3 2 1
14//鎬葷殑嬈℃暟涓?n+1)/2;
15// n =  鍋舵暟鏃訛紝鍙互鍏堟妸n涓嶇錛岃繖鏍穘-1灝變負濂囨暟鐨勬儏鍐碉紝姹傚嚭鍚庣殑搴忓垪鍦ㄥ拰n浜ゆ崲涓涓?br>16//鍗沖彲錛岀粨鏋滀負n/2 + 1;
17//============================================================================
18
19#include <iostream>
20using namespace std;
21void solve(int n) {
22    int x = (n+1)/2 - 1;
23    int y = n;
24    for (int i = 0; i < x; ++i) {
25        cout << n/2 << " " << 2 << " " << y-2-<< endl;
26        n -= 2;
27    }

28    cout <<"" << x << " " << x + 1 << endl;
29}

30
31int main() {
32    int n;
33    cin >> n;
34    if (n == 1{
35        cout << 0 <<endl;
36        return 0;
37    }

38    if (n == 2{
39        cout << "1" <<endl;
40        cout << "1 1 1" <<endl;
41        return 0;
42    }

43    if (n % 2 != 0{
44        cout << (n+1)/2 <<endl;
45         solve(n);
46    }

47    else {
48        cout << n/2 + 1 << endl;
49        solve(n-1);
50        cout << 1 << " "<< n-1 <<" 1" <<endl;
51    }

52
53    return 0;
54}

55
鏈鍚庝竴瀹氳娉ㄦ剰1 鍜?2 鐨勬儏鍐碉紝鎴戝洜涓哄繕浜嗚冭檻錛寃a浜嗗嚑嬈★紝鍛靛懙...

WORM 2009-03-06 08:52 鍙戣〃璇勮
]]>
综合网日日天干夜夜久久 | 亚洲狠狠婷婷综合久久久久| 久久久久久久综合日本| 伊人久久综合无码成人网| 久久久久亚洲av无码专区喷水| 久久精品人人槡人妻人人玩AV| 无码久久精品国产亚洲Av影片| 精品精品国产自在久久高清 | 99久久中文字幕| 久久青草国产手机看片福利盒子| 18岁日韩内射颜射午夜久久成人| 亚洲欧洲精品成人久久奇米网| 亚洲国产欧洲综合997久久| 日韩一区二区久久久久久 | 国产91色综合久久免费| 久久男人中文字幕资源站| 无遮挡粉嫩小泬久久久久久久| 亚洲AV无码成人网站久久精品大| 天天躁日日躁狠狠久久| 99久久99久久精品国产片| 色欲久久久天天天综合网精品| 观看 国产综合久久久久鬼色 欧美 亚洲 一区二区 | 国产99精品久久| 久久青青草视频| 久久这里只有精品久久| 97精品依人久久久大香线蕉97| 91亚洲国产成人久久精品| 久久香蕉超碰97国产精品| 亚洲国产精品无码久久青草| 国产巨作麻豆欧美亚洲综合久久| 色欲综合久久躁天天躁蜜桃| 久久99久久成人免费播放| 久久久无码一区二区三区| 欧美激情一区二区久久久| 中文字幕精品久久| 久久精品亚洲福利| 久久精品?ⅴ无码中文字幕| 国产999精品久久久久久| 国产香蕉97碰碰久久人人| 精品久久综合1区2区3区激情| 亚洲国产精品久久久久网站|