锘??xml version="1.0" encoding="utf-8" standalone="yes"?>伊人久久综合无码成人网,国产福利电影一区二区三区久久老子无码午夜伦不 ,九九久久99综合一区二区http://www.shnenglu.com/cuijiaxing/archive/2014/07/18/207686.html宕斾匠鏄?/dc:creator>宕斾匠鏄?/author>Thu, 17 Jul 2014 16:45:00 GMThttp://www.shnenglu.com/cuijiaxing/archive/2014/07/18/207686.htmlhttp://www.shnenglu.com/cuijiaxing/comments/207686.htmlhttp://www.shnenglu.com/cuijiaxing/archive/2014/07/18/207686.html#Feedback0http://www.shnenglu.com/cuijiaxing/comments/commentRss/207686.htmlhttp://www.shnenglu.com/cuijiaxing/services/trackbacks/207686.htmlkanhaide.blogspot.com,嬈㈣繋鍏変復銆?img src ="http://www.shnenglu.com/cuijiaxing/aggbug/207686.html" width = "1" height = "1" />

]]>
紜竵鎵鵑挶闂http://www.shnenglu.com/cuijiaxing/archive/2012/04/15/171448.html宕斾匠鏄?/dc:creator>宕斾匠鏄?/author>Sun, 15 Apr 2012 02:33:00 GMThttp://www.shnenglu.com/cuijiaxing/archive/2012/04/15/171448.htmlhttp://www.shnenglu.com/cuijiaxing/comments/171448.htmlhttp://www.shnenglu.com/cuijiaxing/archive/2012/04/15/171448.html#Feedback6http://www.shnenglu.com/cuijiaxing/comments/commentRss/171448.htmlhttp://www.shnenglu.com/cuijiaxing/services/trackbacks/171448.html闃呰鍏ㄦ枃

]]>
琛ㄨ揪寮忔眰鍊?/title><link>http://www.shnenglu.com/cuijiaxing/archive/2011/04/24/144916.html</link><dc:creator>宕斾匠鏄?/dc:creator><author>宕斾匠鏄?/author><pubDate>Sun, 24 Apr 2011 13:00:00 GMT</pubDate><guid>http://www.shnenglu.com/cuijiaxing/archive/2011/04/24/144916.html</guid><wfw:comment>http://www.shnenglu.com/cuijiaxing/comments/144916.html</wfw:comment><comments>http://www.shnenglu.com/cuijiaxing/archive/2011/04/24/144916.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.shnenglu.com/cuijiaxing/comments/commentRss/144916.html</wfw:commentRss><trackback:ping>http://www.shnenglu.com/cuijiaxing/services/trackbacks/144916.html</trackback:ping><description><![CDATA[     鎽樿: 浠婂ぉ鍒峰埛鎴戜滑瀛︽牎鐨凮J銆傜湅鍒頒簡閭i亾鎴戜滑澶у閮界啛鎮夌殑琛ㄨ揪寮忔眰鍊奸鐩傚幓緗戜笂鎼滀簡涓嬶紝鍙戠幇娌℃湁鐜版垚鍙敤鐨勫ソ鐨勭畻娉曘備簬鏄嚜宸辮姳浜嗙偣鏃墮棿鍐欎簡涓傛病鏈夊仛榪囧浼樺寲錛屽厛鍙戝嚭鏉ュ啀璇淬?  1#include<stdio.h>  2#include<string.h>  3#include<stack> &nb...  <a href='http://www.shnenglu.com/cuijiaxing/archive/2011/04/24/144916.html'>闃呰鍏ㄦ枃</a><img src ="http://www.shnenglu.com/cuijiaxing/aggbug/144916.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.shnenglu.com/cuijiaxing/" target="_blank">宕斾匠鏄?/a> 2011-04-24 21:00 <a href="http://www.shnenglu.com/cuijiaxing/archive/2011/04/24/144916.html#Feedback" target="_blank" style="text-decoration:none;">鍙戣〃璇勮</a></div>]]></description></item><item><title>騫繪柟闂http://www.shnenglu.com/cuijiaxing/archive/2011/02/16/140181.html宕斾匠鏄?/dc:creator>宕斾匠鏄?/author>Wed, 16 Feb 2011 11:43:00 GMThttp://www.shnenglu.com/cuijiaxing/archive/2011/02/16/140181.htmlhttp://www.shnenglu.com/cuijiaxing/comments/140181.htmlhttp://www.shnenglu.com/cuijiaxing/archive/2011/02/16/140181.html#Feedback0http://www.shnenglu.com/cuijiaxing/comments/commentRss/140181.htmlhttp://www.shnenglu.com/cuijiaxing/services/trackbacks/140181.html闃呰鍏ㄦ枃

]]>
鏂板紑鐨勬ā鍧?鏁版嵁緇撴瀯鍜岀畻娉?/title><link>http://www.shnenglu.com/cuijiaxing/archive/2011/02/16/140179.html</link><dc:creator>宕斾匠鏄?/dc:creator><author>宕斾匠鏄?/author><pubDate>Wed, 16 Feb 2011 11:23:00 GMT</pubDate><guid>http://www.shnenglu.com/cuijiaxing/archive/2011/02/16/140179.html</guid><wfw:comment>http://www.shnenglu.com/cuijiaxing/comments/140179.html</wfw:comment><comments>http://www.shnenglu.com/cuijiaxing/archive/2011/02/16/140179.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.shnenglu.com/cuijiaxing/comments/commentRss/140179.html</wfw:commentRss><trackback:ping>http://www.shnenglu.com/cuijiaxing/services/trackbacks/140179.html</trackback:ping><description><![CDATA[<span style="FONT-FAMILY: Comic Sans MS; FONT-SIZE: 18pt">      緇堜簬鍒頒簡寮濮嬪涔犵畻娉曠殑鏃跺埢浜嗭紝蹇冩儏濂芥縺鍔ㄣ傚幓騫存殤鍋囩敵璇風殑榪欎釜鍗氬鍙堟淳涓婄敤鍦轟簡錛屾垜浼氭妸鎴戞渶榪戝啓鐨勭畻娉曢兘鍙戣〃鍦ㄨ繖閲岋紝甯屾湜澶у鍠滄錛屽叡鍚岃繘姝</span> <img src ="http://www.shnenglu.com/cuijiaxing/aggbug/140179.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.shnenglu.com/cuijiaxing/" target="_blank">宕斾匠鏄?/a> 2011-02-16 19:23 <a href="http://www.shnenglu.com/cuijiaxing/archive/2011/02/16/140179.html#Feedback" target="_blank" style="text-decoration:none;">鍙戣〃璇勮</a></div>]]></description></item><item><title>poj棰樼洰鍒嗙被http://www.shnenglu.com/cuijiaxing/archive/2010/08/21/124210.html宕斾匠鏄?/dc:creator>宕斾匠鏄?/author>Sat, 21 Aug 2010 12:07:00 GMThttp://www.shnenglu.com/cuijiaxing/archive/2010/08/21/124210.htmlhttp://www.shnenglu.com/cuijiaxing/comments/124210.htmlhttp://www.shnenglu.com/cuijiaxing/archive/2010/08/21/124210.html#Feedback0http://www.shnenglu.com/cuijiaxing/comments/commentRss/124210.htmlhttp://www.shnenglu.com/cuijiaxing/services/trackbacks/124210.html闃呰鍏ㄦ枃

]]>
pku 1042http://www.shnenglu.com/cuijiaxing/archive/2010/08/21/124186.html宕斾匠鏄?/dc:creator>宕斾匠鏄?/author>Sat, 21 Aug 2010 07:09:00 GMThttp://www.shnenglu.com/cuijiaxing/archive/2010/08/21/124186.htmlhttp://www.shnenglu.com/cuijiaxing/comments/124186.htmlhttp://www.shnenglu.com/cuijiaxing/archive/2010/08/21/124186.html#Feedback1http://www.shnenglu.com/cuijiaxing/comments/commentRss/124186.htmlhttp://www.shnenglu.com/cuijiaxing/services/trackbacks/124186.html璐績綆楁硶錛屼嬌鐢⊿TL鐨刾riority_queue鏉ョ淮鎶や竴涓槦鍒椼備繚璇侀奔鏁版渶澶氾紙鐩稿悓楸煎垯淇濆瓨鏍囧彿杈冨皬鐨勶級鐨勪竴涓簭鍒椼傜劧鍚庤椽蹇冨氨鍙互浜嗐備竴涓嬫槸浠g爜
#include<iostream>
#include<queue>
using namespace std;
int n,h;
int f[30],t[30],d[30];
int best[30],way[30],maxinum,tot,tag=0;
struct node
{
 int num;
 int fish;
 void set(int id,int f)
 {
  num=id;
  fish=f;
 }
};
bool operator<(const node a,const node b)
{
 if(a.fish==b.fish)
  return a.num>b.num;
 else
  return a.fish<b.fish;
}
priority_queue<node> qu;
node now;
int main()
{
 while(scanf("%d",&n)&&n)
 {
  if(tag)
   printf("\n");
  cin>>h;
  h*=12;
  maxinum=-1;
  int i,j;
  for(i=0;i<n;i++)
  {
   cin>>f[i];
  }
  for(i=0;i<n;i++)
  {
   cin>>d[i];
  }
  for(i=0;i<n-1;i++)
  {
   cin>>t[i];
  }
  ///////////鏁版嵁杈撳叆瀹屾瘯錛屽紑濮嬭繘鍏ヨ綆?br>  for(i=0;i<n;i++)
  {
   memset(way,0,sizeof(way));
   while(!qu.empty())
    qu.pop();
   if(i>0)
    h-=t[i-1];
   tot=0;   
   for(j=0;j<=i;j++)
   {
    now.set(j,f[j]);
    qu.push(now);    
   }
   for(j=0;j<h;j++)
   {
    now=qu.top();
    qu.pop();
    tot+=now.fish;
    now.fish-=d[now.num];
    if(now.fish<0)
     now.fish=0;
    way[now.num]+=5;
    qu.push(now);
   }
   if(tot>maxinum)
   {
    maxinum=tot;
    memcpy(best,way,sizeof(way));
   }

  }
  printf("%d",best[0]);
  for(i=1;i<n;i++)
   printf(", %d",best[i]);
  printf("\nNumber of fish expected: %d\n",maxinum);
  tag=1;
 }
 return 0;

}



]]>
鍏殗鍚庨棶棰?/title><link>http://www.shnenglu.com/cuijiaxing/archive/2010/08/20/124116.html</link><dc:creator>宕斾匠鏄?/dc:creator><author>宕斾匠鏄?/author><pubDate>Fri, 20 Aug 2010 10:34:00 GMT</pubDate><guid>http://www.shnenglu.com/cuijiaxing/archive/2010/08/20/124116.html</guid><wfw:comment>http://www.shnenglu.com/cuijiaxing/comments/124116.html</wfw:comment><comments>http://www.shnenglu.com/cuijiaxing/archive/2010/08/20/124116.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.shnenglu.com/cuijiaxing/comments/commentRss/124116.html</wfw:commentRss><trackback:ping>http://www.shnenglu.com/cuijiaxing/services/trackbacks/124116.html</trackback:ping><description><![CDATA[<p>鍥炴函娉?鍏殗鍚庨棶棰橈紝涓涓粡鍏擱棶棰?/p> <p>     鍦ㄧ▼搴忚璁′腑榪樻湁涓縐嶆柟娉曞彨鍋?鍥炴函娉?.浠栦笉鏄寜鐓ф煇縐嶅叕寮忔垨紜畾鐨勬硶鍒?姹傞棶棰樼殑瑙?鑰屾槸閫氳繃璇曟帰鍜岀籂姝i敊璇殑絳栫暐,鎵懼埌闂鐨勮.榪欑鏂規硶涓鑸槸浠庝竴涓師濮嬬姸鎬佸嚭鍙?閫氳繃鑻ュ共姝ヨ瘯鎺?鏈鍚庤揪鍒扮洰鏍囩姸鎬佺粓姝?<br>    鍥炴函娉曞湪鐞嗚涓婃潵璇?灝辨槸鍦ㄤ竴媯墊悳绱㈡爲涓粠鏍圭粨鐐瑰嚭鍙?鎵懼埌涓鏉¤揪鍒版弧瓚蟲煇鏉′歡鐨勫瓙緇撶偣鐨勮礬寰?鍦ㄦ悳绱㈣繃紼嬩腑,瀵逛簬姣忎竴涓腑闂寸粨鐐?浠栫殑浣嶇疆浠ュ強鍚戜笅鎼滅儲榪囩▼鏄浉浼肩殑,鍥犳瀹屽叏鍙互鐢ㄩ掑綊鏉ュ鐞?鍏稿瀷鐨勪緥瀛愬氨鏄憲鍚嶇殑"鍏殗鍚庨棶棰?.<br>    "鍏殗鍚庨棶棰?鏄湪鍥介檯璞℃媯嬬洏涓婃斁緗叓涓殗鍚?浣垮ス浠笉鑳界浉鍚?鍥介檯璞℃涓殑鐨囧悗鍙互鍚冩帀涓庡ス澶勪簬鍚屼竴琛?鍚屼竴鍒?鍚屼竴瀵硅綰夸笂鐨勬瀛?鍥犳姣忎竴琛屽彧鑳芥憜鏀句竴涓殗鍚?鍥犲叡鏈夊叓琛?鎵浠ユ瘡琛屾湁涓斿彧鏈変竴涓殗鍚?<br>    鍦ㄦ湰渚嬩腑鐨囧悗鐨勪綅緗湁涓涓竴緇存暟緇勬潵瀛樻斁A(I)=J琛ㄧず絎琁琛岀殗鍚庢斁鍦ㄧJ鍒?涓嬮潰涓昏鏉ョ湅鐪嬫庝箞鏍峰垽鏂殗鍚庢槸鍚﹀畨鍏ㄧ殑闂.(1)棣栧厛,鐢ㄤ竴緇存暟緇勬潵琛ㄧず,宸茬粡瑙e喅浜嗕笉鍦ㄥ悓涓琛岀殑闂.(2)瀵逛簬鍒楀彲浠ュ紩榪涗竴涓爣蹇楁暟緇凜[J],鑻鍒椾笂宸叉斁浜嗙殗鍚?鍒機[J]=FALSE.(3)瀵逛簬宸︿笂鍙充笅鐨勫瑙掔嚎I-J涓轟竴甯擱噺,浣嶄簬[-7,+7]涔嬮棿,鍐嶆寮曞叆鏍囧織鏁扮粍L[-7..7];瀵逛簬宸︿笅鍙充笂鐨勫瑙掔嚎,綾諱技鐨勬湁I+J絳変簬甯擱噺,鐢ㄦ暟緇凴[2..16]鏉ヨ〃紺?褰撳湪絎琁琛?絎琂鍒椾笂鏀劇疆浜嗙殗鍚?鍒欏彧闇璁劇疆:C[J]:=FALSE; L[I-J]:=FLASE; R[I+J]:=FALSE灝卞彲浠ヨВ鍐崇殗鍚庣殑瀹夊叏闂浜?</p> <p> </p> <p>闂鎻忚堪錛氬湪鏍囧噯鍥介檯璞℃鐨勬鐩樹笂錛?*8鏍鹼級鍑嗗鏀劇疆8鍙殗鍚庯紝鎴戜滑鐭ラ亾錛屽浗闄呰薄媯嬩腑鐨囧悗鐨勫▉鍔涙槸鏈澶х殑錛屽ス鏃㈠彲浠ユí璧扮珫璧幫紝榪樺彲浠ユ枩鐫璧幫紝閬囧埌鎸″湪濂瑰墠榪涜礬綰夸笂鐨勬晫浜猴紝濂瑰氨鍙互鍚冩帀瀵規墜銆傝姹傚湪媯嬬洏涓婂畨鏀?鍙殗鍚庯紝浣垮ス浠郊姝や簰鐩擱兘涓嶈兘鍚冨埌瀵規柟錛屾眰鐨囧悗鐨勬斁娉曘?br>/************************************************************************/<br>/*銆銆銆銆銆銆銆銆銆銆銆銆銆銆銆銆銆銆銆銆銆銆銆銆銆銆銆銆銆銆銆銆銆銆 */<br>/*銆銆銆銆闂錛氬湪8×8鐨勫浗闄呰薄媯嬫鐩樹笂鏀劇疆8涓殗鍚庯紝瑕佹眰浠繪剰涓や釜鐨囧悗銆銆銆銆銆銆 */<br>/*銆銆銆銆銆銆 涓嶈兘鍦ㄥ悓涓琛屻佸悓涓鍒楁垨鍚屼竴鏉″瑙掔嚎涓娿傘銆銆銆銆銆銆銆銆銆銆銆 */<br>/*銆銆銆銆銆銆銆銆銆銆銆銆銆銆銆銆銆銆銆銆銆銆銆銆銆銆銆銆銆銆銆銆銆銆 */<br>/*銆銆銆銆鏈▼搴忎嬌鐢ㄩ掑綊錛嶅洖婧硶姹傝В8鐨囧悗闂銆俈isual C++ 6.0 璋冭瘯閫氳繃銆傘銆*/<br>/*銆銆銆銆浣滆?鏅ㄦ槦銆銆銆銆 2002騫?鏈?鏃ャ銆銆銆銆銆銆銆銆銆銆銆銆銆銆銆銆銆 */<br>/*銆銆銆銆銆銆銆銆銆銆銆銆銆銆銆銆銆銆銆銆銆銆銆銆銆銆銆銆銆銆銆銆銆銆 */<br>/************************************************************************/<br>#include <stdio.h><br>#include <conio.h><br>#include <math.h><br>#define QUEENS 8<br>//!璁板綍瑙g殑搴忓彿鐨勫叏灞鍙橀噺銆?br>int iCount = 0;<br>//!璁板綍鐨囧悗鍦ㄥ悇鍒椾笂鐨勬斁緗綅緗殑鍏ㄥ眬鏁扮粍銆?br>int Site[QUEENS];<br>//!閫掑綊姹傝В鐨勫嚱鏁般?br>void Queen(int n);<br>//!杈撳嚭涓涓В銆?br>void Output();<br>//!鍒ゆ柇絎琻涓殗鍚庢斁涓婂幓涔嬪悗錛屾槸鍚︽湁鍐茬獊銆?br>int IsValid(int n);<br>/*----------------------------Main錛氫富鍑芥暟銆?----------------------------*/<br>void main()<br>{<br>銆銆銆銆 //!浠庣0鍒楀紑濮嬮掑綊璇曟帰銆?br>銆銆銆銆 Queen(0);<br>銆銆銆銆 //!鎸変換鎰忛敭榪斿洖銆?br>銆銆銆銆 getch();<br>}<br>/*-----------------Queen錛氶掑綊鏀劇疆絎琻涓殗鍚庯紝紼嬪簭鐨勬牳蹇?----------------*/<br>void Queen(int n)<br>{<br>銆銆銆銆 int i;<br>銆銆銆銆 //!鍙傛暟n浠?寮濮嬶紝絳変簬8鏃朵究璇曞嚭浜嗕竴涓В錛屽皢瀹冭緭鍑哄茍鍥炴函銆?br>銆銆銆銆 if(n == QUEENS)<br>銆銆銆銆 {<br>銆銆銆銆銆銆銆銆銆銆 Output();<br>銆銆銆銆銆銆銆銆銆銆 return;<br>銆銆銆銆 }<br>銆銆銆銆銆銆<br>銆銆銆銆 //!n榪樻病鍒?錛屽湪絎琻鍒楃殑鍚勪釜琛屼笂渚濇璇曟帰銆?br>銆銆銆銆 for(i = 1 ; i <= QUEENS ; i++)<br>銆銆銆銆 {<br>銆銆銆銆銆銆銆銆銆銆 //!鍦ㄨ鍒楃殑絎琲琛屼笂鏀劇疆鐨囧悗銆?br>銆銆銆銆銆銆銆銆銆銆 Site[n] = i;<br>銆銆銆銆銆銆銆銆銆銆 //!濡傛灉鏀劇疆娌℃湁鍐茬獊錛屽氨寮濮嬩笅涓鍒楃殑璇曟帰銆?br>銆銆銆銆銆銆銆銆銆銆 if(IsValid(n))<br>銆銆銆銆銆銆銆銆銆銆銆銆銆銆銆銆 Queen(n + 1);<br>銆銆銆銆 }<br>}<br>/*------IsValid錛氬垽鏂n涓殗鍚庢斁涓婂幓涔嬪悗錛屾槸鍚﹀悎娉曪紝鍗蟲槸鍚︽棤鍐茬獊銆?-----*/<br>int IsValid(int n)<br>{<br>銆銆銆銆 int i;<br>銆銆銆銆 //!灝嗙n涓殗鍚庣殑浣嶇疆渚濇浜庡墠闈錛?涓殗鍚庣殑浣嶇疆姣旇緝銆?br>銆銆銆銆 for(i = 0 ; i < n ; i++)<br>銆銆銆銆 {<br>銆銆銆銆銆銆銆銆銆銆 //!涓や釜鐨囧悗鍦ㄥ悓涓琛屼笂錛岃繑鍥?銆?br>銆銆銆銆銆銆銆銆銆銆 if(Site[i] == Site[n])<br>銆銆銆銆銆銆銆銆銆銆銆銆銆銆銆銆 return 0;<br>銆銆銆銆銆銆銆銆銆銆 //!涓や釜鐨囧悗鍦ㄥ悓涓瀵硅綰夸笂錛岃繑鍥?銆?br>銆銆銆銆銆銆銆銆銆銆 if(abs(Site[i] - Site[n]) == (n - i))<br>銆銆銆銆銆銆銆銆銆銆銆銆銆銆銆銆 return 0;<br>銆銆銆銆 }<br>銆銆銆銆 //!娌℃湁鍐茬獊錛岃繑鍥?銆?br>銆銆銆銆 return 1;<br>}<br>/*------------Output錛氳緭鍑轟竴涓В錛屽嵆涓縐嶆病鏈夊啿紿佺殑鏀劇疆鏂規銆?-----------*/<br>void Output()<br>{<br>銆銆銆銆 int i;<br>銆銆銆銆 //!杈撳嚭搴忓彿銆?br>銆銆銆銆 printf("No.%-5d" , ++iCount);<br>銆銆銆銆 //!渚濇杈撳嚭鍚勪釜鍒椾笂鐨勭殗鍚庣殑浣嶇疆錛屽嵆鎵鍦ㄧ殑琛屾暟銆?br>銆銆銆銆 for(i = 0 ; i < QUEENS ; i++)<br>銆銆銆銆銆銆銆銆銆銆 printf("%d " , Site[i]);<br>銆銆銆銆 printf("n");<br>}</p> <p><br>STL婧愪唬鐮?br>鐢ㄤ簡STL, 鏂規硶鏄竴鏍風殑.<br>#include <iostream><br>#include <string><br>using namespace std;<br>void queen(const string t, const string s)<br>{<br>銆銆銆銆if (s=="") cout<<t<<endl;<br>銆銆銆銆else<br>銆銆銆銆銆銆銆銆for (int i=0; i<s.length(); i++) {<br>銆銆銆銆銆銆銆銆銆銆銆銆bool safe=true;<br>銆銆銆銆銆銆銆銆銆銆銆銆for (int j=0;j<t.length();j++) {<br>銆銆銆銆銆銆銆銆銆銆銆銆銆銆銆銆if (t.length()-j==abs(s[i]-t[j])) safe=false;<br>銆銆銆銆銆銆銆銆銆銆銆銆}<br>銆銆銆銆銆銆銆銆銆銆銆銆if (safe) queen(t+s[i], s.substr(0,i)+s.substr(i+1));<br>銆銆銆銆}<br>}<br>int main()<br>{<br>            string s="01234567";<br>銆銆銆銆queen("",s);<br>銆銆銆銆system("PAUSE");<br>銆銆銆銆exit(EXIT_SUCCESS);<br>}</p> <p>閫掑綊瑙e叓鐨囧悗闂<br>/*閫掑綊娉曡В鍏殗鍚庨棶棰?/<br>/*浣滆呴粍鍥界憸錛屻婃暟鎹粨鏋勶紙C璇█鐗堬級銆嬫竻鍗庡ぇ瀛﹀嚭鐗堢ぞ*/<br>char Chessboard[8][8]; /*澹版槑8錛?鐨勭┖鐧芥鐩?/<br>int N_Queens(int LocX, int LocY, int Queens) /*閫掑綊*/<br>{<br>int i,j;<br>int Result=0;<br>if(Queens == 8)/*閫掑綊緇撴潫鏉′歡*/<br>銆銆 return 1;<br>else if(QueenPlace(LocX,LocY))/*閫掑綊鎵ц閮ㄥ垎*/<br>銆銆{<br>銆銆Chessboard[LocX][LocY] = 'Q';<br>銆銆for(i=0;i<8;i++)<br>銆銆銆銆for(j=0;j<8;j++)<br>銆銆銆銆{<br>銆銆銆銆Result += N_Queens(i,j,Queens+1);<br>銆銆銆銆if(Result>0)<br>銆銆銆銆銆銆break;<br>銆銆銆銆}<br>銆銆if(Result>0)<br>銆銆銆銆return 1;<br>銆銆else<br>銆銆銆銆{<br>銆銆銆銆Chessboard[LocX][LocY] = 'X';<br>銆銆銆銆}<br>銆銆}<br>else<br>銆銆return 0;<br>}<br>int QueenPlace(int LocX,int LocY) /*鍒ゆ柇浼犲叆鍧愭爣鏈韓鍙婂叆鍏釜鏂瑰悜涓婃槸鍚︽湁鐨囧悗*/<br>{<br>int i,j;<br>if(Chessboard[LocX][LocY] != 'X')<br>銆銆return 0;<br>for(j=LocY-1;j>=0;j--)<br>銆銆if(Chessboard[LocX][j] != 'X')<br>銆銆銆銆return 0;<br>for(j=LocY+1;j<8;j++)<br>銆銆if(Chessboard[LocX][j] != 'X')<br>銆銆銆銆return 0;<br>for(i=LocX-1;i>=0;i--)<br>銆銆if(Chessboard[i][LocY] != 'X')<br>銆銆銆銆return 0;<br>for(i=LocX+1;i<8;i++)<br>銆銆if(Chessboard[i][LocY] != 'X')<br>銆銆銆銆return 0;<br>i= LocX - 1;<br>j= LocY - 1;<br>while (i>=0&&j>=0)<br>銆銆if(Chessboard[i--][j--] != 'X')<br>銆銆銆銆return 0;<br>i= LocX + 1;<br>j= LocY - 1;<br>while (i<8&&j>=0)<br>銆銆if(Chessboard[i++][j--] != 'X')<br>銆銆銆銆return 0;<br>i= LocX - 1;<br>j= LocY + 1;<br>while (i>=0&&j<8)<br>銆銆if(Chessboard[i--][j++] != 'X')<br>銆銆銆銆return 0;<br>i= LocX + 1;<br>j= LocY + 1;<br>while (i<8&&j<8)<br>銆銆if(Chessboard[i++][j--] != 'X')<br>銆銆銆銆return 0;<br>return 1;<br>}<br>main() /*涓葷▼搴?/<br>{<br>int i,j;<br>for(i=0;i<8;i++)<br>銆銆for(j=0;j<8;j++)<br>銆銆銆銆Chessboard[i][j] = 'X';<br>N_Queens(0,0,0);<br>printf("the graph of 8 Queens on the Chessboard.is:n");<br>for(i=0;i<8;i++)<br>銆銆for(j=0;j<8;j++)<br>銆銆{<br>銆銆if(Chessboard[i][j] == 'Q')<br>銆銆銆銆printf("(%d,%d)n",i,j);<br>銆銆}<br>getch();<br>}<br>/*********************************************************<br>*****************鍏殗鍚庨棶棰?******************************<br>************鏍規嵁涓ヤ功緇欑殑綾籧綆楁硶姹傚緱************************<br>*********************************************************/<br>#include<stdio.h><br>#define N 8<br>int col=1,row=1,slash=1,bslash=1;<br>int a[N][N];<br>int p,q,k,l;<br>int num=0;<br>void trial(int i)<br>{<br>int j;銆銆 /*娉?鎰忥紝榪欓噷鐨刯 涓瀹氳璁句負鍐呴儴鍙橀噺*/<br>if(i==N)<br>{<br>num++;<br>for(k=0;k<N;k++)<br>{<br>for(l=0;l<N;l++)<br>{<br>銆銆if(a[k][l]==1)<br>銆銆 printf("@");<br>銆銆else printf("*");<br>}<br>printf("n");<br>}<br>printf("nn");<br>getchar();<br>}<br>else<br>{<br>for(j=0;j<N;j++)<br>{<br>for(k=0;k<i;k++)<br>銆銆if(a[k][j]==1)<br>銆銆{<br>銆銆 col=0;<br>銆銆 break;<br>銆銆}銆銆銆銆 /*鍒?/<br>p=i-1;<br>q=j+1;<br>while((p>=0)&&(q<N))<br>{<br>銆銆if(a[p][q]==1)<br>銆銆{<br>銆銆 slash=0;<br>銆銆 break;<br>銆銆}<br>銆銆p--;<br>銆銆q++;<br>}<br>p=i-1;<br>q=j-1; /*瀵硅*/<br>while((p>=0)&&(q>=0))<br>{<br>銆銆if(a[p][q]==1)<br>銆銆{<br>銆銆 bslash=0;<br>銆銆 break;<br>銆銆}<br>銆銆p--;<br>銆銆q--;<br>}銆銆銆銆銆銆/*鏂滃瑙?/<br>if((col==1)&&(slash==1)&&(bslash==1)) /*鏉′歡鍒ゆ柇*/<br>{<br>銆銆a[i][j]=1;<br>銆銆trial(i+1);<br>}<br>col=1;slash=1;bslash=1;<br>a[i][j]=0;<br>}<br>}<br>}<br>void main()<br>{<br>trial(0);<br>printf("%dn",num);<br>getchar();<br>}</p> <img src ="http://www.shnenglu.com/cuijiaxing/aggbug/124116.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.shnenglu.com/cuijiaxing/" target="_blank">宕斾匠鏄?/a> 2010-08-20 18:34 <a href="http://www.shnenglu.com/cuijiaxing/archive/2010/08/20/124116.html#Feedback" target="_blank" style="text-decoration:none;">鍙戣〃璇勮</a></div>]]></description></item><item><title>鍏ㄦ帓鍒楃畻娉?Using c++ template): http://www.shnenglu.com/cuijiaxing/archive/2010/08/20/124073.html宕斾匠鏄?/dc:creator>宕斾匠鏄?/author>Fri, 20 Aug 2010 02:51:00 GMThttp://www.shnenglu.com/cuijiaxing/archive/2010/08/20/124073.htmlhttp://www.shnenglu.com/cuijiaxing/comments/124073.htmlhttp://www.shnenglu.com/cuijiaxing/archive/2010/08/20/124073.html#Feedback2http://www.shnenglu.com/cuijiaxing/comments/commentRss/124073.htmlhttp://www.shnenglu.com/cuijiaxing/services/trackbacks/124073.html榪欐槸涓涓叏鎺掑垪綆楁硶鐨凜++妯℃澘, 涓嶴TL涓硾鍨嬬畻娉昻ext_permutation鐨勫姛鑳芥槸涓鏍風殑銆?br>
template < typename T >
bool _next_permutation( T *first, T *last );
#define N 8
int main(int argc, char* argv[])
{
        int i;
        int y = 1;//搴忓彿
        char a[N];
        for ( i=0; i<N; i++ )
        {
                a[i] = i + 1 + 64 + 32;
        }

        long t0 = time( NULL );
        do
        {
                cout << y << "銆--->銆";
                for ( i = 0; i<N; i++ ) cout << a[i];
                cout << endl;

                y++;
        }while( _next_permutation( &a[0], &a[N] ) );
        long t1 = time( NULL ) - t0;
        cout << t1 << endl;//褰揘涓?鏃惰楁椂130縐掞紝涓庢硾鍨嬬畻娉昻ext_permutation鐢ㄦ椂涓鏍?br>
        return 0;
}

template < typename T >
bool _next_permutation( T *first, T *last )
{
        int i;
        int j;
        int x = -1;
        int rang = last - first;
       
        for ( i=0; i<rang-1; i++ )
        {
                if ( *( first+i ) <= *( first+i+1 ) )
                {
                        x = i;
                }
        }

        if ( x != -1 )
        {
                for ( i=x; i<rang; i++ )
                {
                        if ( *( first+x ) <= *( first+i ) )
                        {
                                j = i;
                        }
                }

                _swap( *( first+x ), *( first+j ) );

                for ( i=x+1; i<rang; i++ )
                {
                        if ( i != rang + x - i )
                        {
                                int nSwap = rang + x - i;
                                _swap( *( first+i ), *( first+ ( rang+x-i ) ) );
                        }
                        if ( ( i + 1 ) * 2 > rang + x )
                        {
                                break;
                        }
                }
        }

        if ( -1 == x ) return false;
        else return true;
}

template < typename T >
void _swap( T &a, T &b )
{
        a = a + b;
        b = a - b;
        a = a - b;
}


]]>
poj 2572http://www.shnenglu.com/cuijiaxing/archive/2010/08/19/123979.html宕斾匠鏄?/dc:creator>宕斾匠鏄?/author>Thu, 19 Aug 2010 08:26:00 GMThttp://www.shnenglu.com/cuijiaxing/archive/2010/08/19/123979.htmlhttp://www.shnenglu.com/cuijiaxing/comments/123979.htmlhttp://www.shnenglu.com/cuijiaxing/archive/2010/08/19/123979.html#Feedback0http://www.shnenglu.com/cuijiaxing/comments/commentRss/123979.htmlhttp://www.shnenglu.com/cuijiaxing/services/trackbacks/123979.html澶ф暣鏁扮殑鍔犳硶銆備笌浠ュ墠楂樼簿搴︾畻娉曚笉鍚岀殑鏄繖嬈¤涓涓嬪瓙璇誨叆涓涓畻寮忋傜劧鍚庣畝渚跨殑鏄紝榪欐涓嶇敤鍐嶄氦鎹㈤『搴忎簡錛岀洿鎺ュ姞銆備絾鏄粨鏋滅殑鍒ゆ柇紼嶅井楹葷儲涓鐐癸紝瑕佹妸寮澶寸殑0閮藉幓鎺夋墠琛屻備竴涓嬫槸鎴戠殑浠g爜銆傚搸錛屽垰寮濮嬫妸鑷繁寮勫緱鎸烘販涔辯殑錛屽悗鏉ユ劋鎬掍簡錛屽氨鎶婃墍鏈変唬鐮佸叏鍒犳帀閲嶆柊鍐欎簡涓閬嶃傜劧鍚庝竴嬈C
#include<iostream>
#include<stdio.h>
#include<cstring>
using namespace std;
char a[12],b[12],c[12];
char temp[25];
bool add(char *first,char *second)
{
 int len1=strlen(first);
 int len2=strlen(second);
 first[len1]='0';
 int i,j;
 for(i=0;i<len2;i++)
 {
  second[i]-='0';
 }
 for(j=0;j<=len1;j++)
 {
  first[j]-='0';
 }
 for(i=0;i<len2;i++)
 {
  first[i]+=second[i];
 }
 for(i=0;i<len1;i++)
 {
  if(first[i]>=10)
  {
   first[i+1]+=first[i]/10;
   first[i]%=10;
  }
 }
 for(i=0;i<=len1;i++)
  first[i]+='0';
 while(first[len1]=='0')
  len1--;
 int len3=strlen(c);
 len3--;
 while(c[len3]=='0')
  len3--;
 if(len1!=len3)
  return false;
 while(len3>=0)
 {
  if(c[len3]!=first[len3])
   return false;
  len3--;
 }
 return true;
}
int main()
{
 while(gets(temp))
 {
  int kk=0;
  while(temp[kk]!='+')
  {
   a[kk]=temp[kk];
   kk++;
  }
  a[kk]='\0';
  kk++;
  int kkk=0;
  while(temp[kk]!='=')
  {
   b[kkk]=temp[kk];
   kk++;kkk++;
  }
  b[kkk]='\0';
  kk++;
  kkk=0;
  while(temp[kk]!='\0')
  {
   c[kkk]=temp[kk];
   kk++;kkk++;
  }
  c[kkk]='\0';

  int len1=strlen(a);
  int len2=strlen(b);
  if(len1==1&&len2==1&&a[0]=='0'&&b[0]=='0')
  {
   cout<<"True"<<endl;
   break;
  }
  if(len1>len2)
   if(add(a,b))
    cout<<"True"<<endl;
   else
    cout<<"False"<<endl;
  else
   if(add(b,a))
    cout<<"True"<<endl;
   else
    cout<<"False"<<endl;
 }
 return 0;

}



]]>
精品久久香蕉国产线看观看亚洲| 天天久久狠狠色综合| 精品久久一区二区| 97久久精品国产精品青草| 精品国产VA久久久久久久冰| 国内精品久久久久影院优| 精品综合久久久久久888蜜芽| 久久无码人妻一区二区三区 | 久久久久成人精品无码中文字幕| 思思久久精品在热线热| 久久久久久午夜成人影院| 伊人久久免费视频| 日本加勒比久久精品| 久久久国产精华液| 久久久久综合网久久| 欧美日韩成人精品久久久免费看| 久久中文字幕人妻丝袜| 青草影院天堂男人久久| 久久天天躁狠狠躁夜夜avapp| 亚洲中文字幕无码久久2020| 久久青青草原精品影院| 久久精品极品盛宴观看| 久久精品国产亚洲综合色| 中文字幕精品无码久久久久久3D日动漫| 久久这里都是精品| 国产精品免费久久久久久久久 | 97精品伊人久久久大香线蕉| 国产精品9999久久久久| 久久亚洲熟女cc98cm| 国产午夜电影久久| www久久久天天com| 亚洲欧洲久久久精品| 99久久婷婷国产一区二区| 亚洲午夜久久久久久久久久| 激情五月综合综合久久69| 国产精品久久久久国产A级| 久久久久久国产精品无码下载| 久久久久亚洲AV无码专区网站| 久久99精品久久久久久| 99久久婷婷国产综合亚洲| 亚洲色欲久久久综合网东京热|