<?xml version="1.0" encoding="gb2312"?>
<rss version="2.0">
<channel>
<title><![CDATA[IT随笔]]></title>
        <image>
        <title>http://hi.baidu.com</title>
        <link>http://hi.baidu.com</link>
        <url>http://img.baidu.com/img/logo-hi.gif</url>
        </image>
<description><![CDATA[Coding Now  /  Programming Future]]></description>
<link>http://hi.baidu.com/yjy2410578</link>
<language>zh-cn</language>
<generator>www.baidu.com</generator>
<ttl>5</ttl>


<item>
        <title><![CDATA[在线制作ico图标]]></title>
        <link><![CDATA[http://hi.baidu.com/yjy2410578/blog/item/d9bbe9b3f7108eadd8335a4e.html]]></link>
        <description><![CDATA[
		
		<p><a href="http://www.bitbug.net/">http://www.bitbug.net/</a></p>
<p> </p> 
		
		<br/><b>类别：</b><a href="http://hi.baidu.com/yjy2410578/blog/category/Qt">Qt</a>&nbsp;<a href="http://hi.baidu.com/yjy2410578/blog/item/d9bbe9b3f7108eadd8335a4e.html#comment">查看评论</a>]]></description>
        <pubDate>2009-11-25  09:56</pubDate>
        <category><![CDATA[Qt]]></category>
        <author><![CDATA[yjy2410578]]></author>
		<guid>http://hi.baidu.com/yjy2410578/blog/item/d9bbe9b3f7108eadd8335a4e.html</guid>
</item>

<item>
        <title><![CDATA[nk2081 未完成]]></title>
        <link><![CDATA[http://hi.baidu.com/yjy2410578/blog/item/77a4c31f5b5d16c2a68669e9.html]]></link>
        <description><![CDATA[
		
		<p>#include &lt;stdio.h&gt;<br>
#include &lt;string.h&gt;<br>
#include &lt;iostream&gt;<br>
#include &lt;algorithm&gt;<br>
using namespace std;<br>
const int NDSZ = 100000;<br>
const int EDSZ = 1000000;<br>
const int LEN = 1000000;<br>
class Edge{<br>
public:<br>
 int fr,to;<br>
 Edge(int f=0,int t=0):fr(f),to(t){}<br>
};<br>
int que[LEN];<br>
bool used[NDSZ];<br>
int dis[NDSZ];<br>
Edge e[EDSZ];<br>
int st[NDSZ],ed[NDSZ];<br>
int val[NDSZ];<br>
void init();<br>
int n,m,tot;<br>
bool cmp(const Edge &amp; ,const Edge &amp; );<br>
int spfa(int src , int dest);<br>
void show();<br>
void showdis();<br>
int main(){<br>
 freopen(&quot;datin.txt&quot;,&quot;r&quot;,stdin);<br>
 while (scanf(&quot;%d%d&quot;,&amp;n,&amp;m)!=EOF){<br>
&nbsp;&nbsp; init();<br>
&nbsp;&nbsp; show();<br>
&nbsp;&nbsp; int ans = spfa(0,n-1);<br>
&nbsp;&nbsp; printf(&quot;%d\n&quot;,ans);<br>
 }<br>
 return 0;<br>
}<br>
void init(){<br>
 int i;<br>
 for (i=0;i&lt;n;i++){<br>
&nbsp;&nbsp; scanf(&quot;%d&quot;,&amp;val[i]);<br>
 }<br>
  tot=0;<br>
 for (i=0;i&lt;m;i++){<br>
&nbsp;&nbsp; int fr,to,flag;<br>
&nbsp;&nbsp; scanf(&quot;%d%d%d&quot;,&amp;fr,&amp;to,&amp;flag);<br>
&nbsp;&nbsp; fr--;<br>
&nbsp;&nbsp; to--;<br>
&nbsp;&nbsp; if (1==flag){<br>
&nbsp;&nbsp;&nbsp; e[tot++]=Edge(fr,to);<br>
&nbsp;&nbsp; }else if(2==flag){<br>
&nbsp;&nbsp;&nbsp; e[tot++]=Edge(fr,to);<br>
&nbsp;&nbsp;&nbsp; e[tot++]=Edge(to,fr);<br>
&nbsp;&nbsp; }<br>
 }<br>
 sort(e,e+tot,cmp);<br>
 int last = e[0].fr;<br>
 st[last]=0;<br>
 for (i=0;i&lt;tot;i++){<br>
&nbsp;&nbsp; if (last!=e[i].fr){<br>
&nbsp;&nbsp;&nbsp; ed[last]=i;<br>
&nbsp;&nbsp;&nbsp; last=e[i].fr;<br>
&nbsp;&nbsp;&nbsp; st[last]=i;<br>
&nbsp;&nbsp; }<br>
 }<br>
 ed[last]=tot;<br>
 <br>
}<br>
bool cmp(const Edge &amp; a,const Edge &amp; b){<br>
 if (a.fr!=b.fr){<br>
&nbsp;&nbsp; return a.fr&lt;b.fr;<br>
 }else{<br>
&nbsp;&nbsp; return a.to&lt;b.to;<br>
 }<br>
}<br>
int spfa(int src , int dest){<br>
 memset(dis,0,sizeof(dis));<br>
 int head=0,tail=1;<br>
 que[0]=src;<br>
 memset(used,false,sizeof(used));<br>
 used[src]=true;<br>
 while (head!=tail){<br>
&nbsp;&nbsp; int nd = que[head];<br>
&nbsp;&nbsp; printf(&quot;nd: %d\n&quot;,nd+1);<br>
&nbsp;&nbsp; head=(head+1)%LEN;<br>
&nbsp;&nbsp; used[nd]=false;<br>
&nbsp;&nbsp; int i;<br>
&nbsp;&nbsp; for (i=st[nd];i&lt;ed[nd];i++){<br>
&nbsp;&nbsp;&nbsp; int nx = e[i].to;<br>
&nbsp;&nbsp;&nbsp;<br>
&nbsp;&nbsp;&nbsp; int deta =val[nx]-val[nd];<br>
&nbsp;&nbsp;&nbsp; printf(&quot;check : %d --&gt; %d deta: %d\n&quot;,nd+1 , nx+1,deta);<br>
&nbsp;&nbsp;&nbsp; if (deta&gt;dis[nx]){<br>
&nbsp;&nbsp;&nbsp;&nbsp; dis[nx]=deta;<br>
&nbsp;&nbsp;&nbsp;&nbsp; if (!used[nx]){<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; used[nx]=true;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; que[tail]=nx;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; tail=(tail+1)%LEN;<br>
&nbsp;&nbsp;&nbsp;&nbsp; }<br>
&nbsp;&nbsp;&nbsp; }<br>
&nbsp;&nbsp; }<br>
 }<br>
 showdis();<br>
 return dis[dest];<br>
}<br>
void show(){<br>
 int i,j;<br>
 printf(&quot;edge: \n&quot;);<br>
 for (i=0;i&lt;tot;i++){<br>
&nbsp;&nbsp; printf(&quot;%d---&gt; %d\n&quot;,e[i].fr+1,e[i].to+1);<br>
 }<br>
 for (i=0;i&lt;n;i++){<br>
&nbsp;&nbsp; printf(&quot;nd: %d\n&quot;,i+1);<br>
&nbsp;&nbsp; for (j=st[i];j&lt;ed[i];j++){<br>
&nbsp;&nbsp;&nbsp; printf(&quot; %d &quot;,e[j].to+1);<br>
&nbsp;&nbsp; }<br>
&nbsp;&nbsp; printf(&quot;\n&quot;);<br>
 }<br>
}</p>
<p>void showdis(){<br>
 int i;<br>
 for (i=0;i&lt;n;i++){<br>
&nbsp;&nbsp; printf(&quot;dis [%d] = %d \n&quot;,i+1,dis[i]);<br>
 }<br>
}</p> <a href="http://hi.baidu.com/yjy2410578/blog/item/77a4c31f5b5d16c2a68669e9.html">阅读全文</a>
		
		<br/><b>类别：</b><a href="http://hi.baidu.com/yjy2410578/blog/category/Oj">Oj</a>&nbsp;<a href="http://hi.baidu.com/yjy2410578/blog/item/77a4c31f5b5d16c2a68669e9.html#comment">查看评论</a>]]></description>
        <pubDate>2009-11-23  16:42</pubDate>
        <category><![CDATA[Oj]]></category>
        <author><![CDATA[yjy2410578]]></author>
		<guid>http://hi.baidu.com/yjy2410578/blog/item/77a4c31f5b5d16c2a68669e9.html</guid>
</item>

<item>
        <title><![CDATA[qt 中文乱码处理]]></title>
        <link><![CDATA[http://hi.baidu.com/yjy2410578/blog/item/b539b12c520a6be68b1399af.html]]></link>
        <description><![CDATA[
		
		 this-&gt;codec=QTextCodec::codecForName(&quot;UTF-8&quot;);
<p style="text-indent: 0px; margin: 0px; -qt-block-indent: 0; -qt-user-state: 256">m_ui-&gt;butall-&gt;setText(codec-&gt;toUnicode(&quot;猪猪&quot;));</p> 
		
		<br/><b>类别：</b><a href="http://hi.baidu.com/yjy2410578/blog/category/Qt">Qt</a>&nbsp;<a href="http://hi.baidu.com/yjy2410578/blog/item/b539b12c520a6be68b1399af.html#comment">查看评论</a>]]></description>
        <pubDate>2009-11-22  00:41</pubDate>
        <category><![CDATA[Qt]]></category>
        <author><![CDATA[yjy2410578]]></author>
		<guid>http://hi.baidu.com/yjy2410578/blog/item/b539b12c520a6be68b1399af.html</guid>
</item>

<item>
        <title><![CDATA[sql table ansd maper]]></title>
        <link><![CDATA[http://hi.baidu.com/yjy2410578/blog/item/f5fb75133727768a6438db2b.html]]></link>
        <description><![CDATA[
		
		<p>//start</p>
<p>#include &quot;stuin.h&quot;</p>
<p style="text-indent: 0px; margin: 0px; -qt-block-indent: 0; -qt-user-state: 0">#include &quot;ui_stuin.h&quot;</p>
<p style="text-indent: 0px; margin: 0px; -qt-block-indent: 0; -qt-paragraph-type: empty"> </p>
<p style="text-indent: 0px; margin: 0px; -qt-block-indent: 0; -qt-user-state: 0">Stuin::Stuin(QWidget *parent)</p>
<p style="text-indent: 0px; margin: 0px; -qt-block-indent: 0; -qt-user-state: 0">: QWidget(parent), ui(new Ui::Stuin)</p>
<p style="text-indent: 0px; margin: 0px; -qt-block-indent: 0; -qt-user-state: 256">{</p>
<p style="text-indent: 0px; margin: 0px; -qt-block-indent: 0; -qt-user-state: 256">//ui-&gt;setupUi(this);</p>
<p style="text-indent: 0px; margin: 0px; -qt-block-indent: 0; -qt-user-state: 256">this-&gt;move(10,20);</p>
<p style="text-indent: 0px; margin: 0px; -qt-block-indent: 0; -qt-user-state: 256">//this-&gt;setFixedSize(this-&gt;size());</p>
<p style="text-indent: 0px; margin: 0px; -qt-block-indent: 0; -qt-user-state: 256">//this-&gt;resize(this-&gt;width(),this-&gt;height()*2);</p>
<p style="text-indent: 0px; margin: 0px; -qt-block-indent: 0; -qt-user-state: 256">this-&gt;conn=QSqlDatabase::database();</p>
<p style="text-indent: 0px; margin: 0px; -qt-block-indent: 0; -qt-user-state: 512">if (!conn.open()){</p>
<p style="text-indent: 0px; margin: 0px; -qt-block-indent: 0; -qt-user-state: 512">qDebug()&lt;&lt;&quot;failed connect mysql&quot;;</p>
<p style="text-indent: 0px; margin: 0px; -qt-block-indent: 0; -qt-user-state: 512">}else{</p>
<p style="text-indent: 0px; margin: 0px; -qt-block-indent: 0; -qt-user-state: 512">model=new QSqlTableModel(this,conn);</p>
<p style="text-indent: 0px; margin: 0px; -qt-block-indent: 0; -qt-user-state: 512">model-&gt;setTable(&quot;stuinfo&quot;);</p>
<p style="text-indent: 0px; margin: 0px; -qt-block-indent: 0; -qt-user-state: 512">model-&gt;setHeaderData(0,Qt::Horizontal,tr(&quot;miaomiaoid&quot;));</p>
<p style="text-indent: 0px; margin: 0px; -qt-block-indent: 0; -qt-user-state: 512">model-&gt;select();</p>
<p style="text-indent: 0px; margin: 0px; -qt-block-indent: 0; -qt-user-state: 512">model-&gt;record(0);</p>
<p style="text-indent: 0px; margin: 0px; -qt-block-indent: 0; -qt-user-state: 512">this-&gt;view=new QTableView(this);</p>
<p style="text-indent: 0px; margin: 0px; -qt-block-indent: 0; -qt-user-state: 512">view-&gt;setModel(model);</p>
<p style="text-indent: 0px; margin: 0px; -qt-block-indent: 0; -qt-user-state: 512">view-&gt;show();</p>
<p style="text-indent: 0px; margin: 0px; -qt-block-indent: 0; -qt-user-state: 512">view-&gt;resize(600,400);</p>
<p style="text-indent: 0px; margin: 0px; -qt-block-indent: 0; -qt-user-state: 512">view-&gt;setColumnHidden(0,true);</p>
<p style="text-indent: 0px; margin: 0px; -qt-block-indent: 0; -qt-paragraph-type: empty"> </p>
<p style="text-indent: 0px; margin: 0px; -qt-block-indent: 0; -qt-user-state: 512">QPushButton *but = new QPushButton(&quot;miao&quot;);</p>
<p style="text-indent: 0px; margin: 0px; -qt-block-indent: 0; -qt-user-state: 512">but-&gt;setParent(this);</p>
<p style="text-indent: 0px; margin: 0px; -qt-block-indent: 0; -qt-user-state: 512">but-&gt;show();</p>
<p style="text-indent: 0px; margin: 0px; -qt-block-indent: 0; -qt-user-state: 512">but-&gt;move(500,500);</p>
<p style="text-indent: 0px; margin: 0px; -qt-block-indent: 0; -qt-user-state: 512">connect(but,SIGNAL(clicked()),model,SLOT(submitAll()));</p>
<p style="text-indent: 0px; margin: 0px; -qt-block-indent: 0; -qt-user-state: 512">QPushButton *jmp=new QPushButton(&quot;jmp&quot;);</p>
<p style="text-indent: 0px; margin: 0px; -qt-block-indent: 0; -qt-user-state: 512">jmp-&gt;setParent(this);</p>
<p style="text-indent: 0px; margin: 0px; -qt-block-indent: 0; -qt-user-state: 512">jmp-&gt;show();</p>
<p style="text-indent: 0px; margin: 0px; -qt-block-indent: 0; -qt-user-state: 512">jmp-&gt;move(300,500);</p>
<p style="text-indent: 0px; margin: 0px; -qt-block-indent: 0; -qt-user-state: 512">connect(jmp,SIGNAL(clicked()),this,SLOT(jmpwin()));</p>
<p style="text-indent: 0px; margin: 0px; -qt-block-indent: 0; -qt-user-state: 256">}</p>
<p style="text-indent: 0px; margin: 0px; -qt-block-indent: 0; -qt-user-state: 0">}</p>
<p style="text-indent: 0px; margin: 0px; -qt-block-indent: 0; -qt-paragraph-type: empty"> </p>
<p style="text-indent: 0px; margin: 0px; -qt-block-indent: 0; -qt-user-state: 256">void Stuin::jmpwin(){</p>
<p style="text-indent: 0px; margin: 0px; -qt-block-indent: 0; -qt-user-state: 256">Input *win = new Input(this);</p>
<p style="text-indent: 0px; margin: 0px; -qt-block-indent: 0; -qt-user-state: 256">win-&gt;exec();</p>
<p style="text-indent: 0px; margin: 0px; -qt-block-indent: 0; -qt-user-state: 0">}</p>
<p style="text-indent: 0px; margin: 0px; -qt-block-indent: 0; -qt-user-state: 0">Stuin::~Stuin()</p>
<p style="text-indent: 0px; margin: 0px; -qt-block-indent: 0; -qt-user-state: 256">{</p>
<p style="text-indent: 0px; margin: 0px; -qt-block-indent: 0; -qt-user-state: 256">delete ui;</p>
<p style="text-indent: 0px; margin: 0px; -qt-block-indent: 0; -qt-user-state: 0">}</p>
<p style="text-indent: 0px; margin: 0px; -qt-block-indent: 0; -qt-paragraph-type: empty"> </p>
<p style="text-indent: 0px; margin: 0px; -qt-block-indent: 0; -qt-user-state: 0">void Stuin::on_pushButton_toggled(bool checked)</p>
<p style="text-indent: 0px; margin: 0px; -qt-block-indent: 0; -qt-user-state: 256">{</p>
<p style="text-indent: 0px; margin: 0px; -qt-block-indent: 0; -qt-user-state: 256">qDebug()&lt;&lt;checked;</p>
<p style="text-indent: 0px; margin: 0px; -qt-block-indent: 0; -qt-user-state: 512">if (checked){</p>
<p style="text-indent: 0px; margin: 0px; -qt-block-indent: 0; -qt-user-state: 512">this-&gt;resize(this-&gt;width(),this-&gt;height()*2);</p>
<p style="text-indent: 0px; margin: 0px; -qt-block-indent: 0; -qt-user-state: 512">this-&gt;update();</p>
<p style="text-indent: 0px; margin: 0px; -qt-block-indent: 0; -qt-user-state: 512">}else{</p>
<p style="text-indent: 0px; margin: 0px; -qt-block-indent: 0; -qt-user-state: 512">this-&gt;resize(this-&gt;width(),this-&gt;height()/2);</p>
<p style="text-indent: 0px; margin: 0px; -qt-block-indent: 0; -qt-user-state: 512">this-&gt;update();</p>
<p style="text-indent: 0px; margin: 0px; -qt-block-indent: 0; -qt-user-state: 256">}</p>
<p style="text-indent: 0px; margin: 0px; -qt-block-indent: 0; -qt-user-state: 0">}</p>
<p style="text-indent: 0px; margin: 0px; -qt-block-indent: 0; -qt-paragraph-type: empty"> </p>
<p style="text-indent: 0px; margin: 0px; -qt-block-indent: 0; -qt-user-state: 0">void Stuin::on_pushButton_clicked(bool checked)</p>
<p style="text-indent: 0px; margin: 0px; -qt-block-indent: 0; -qt-user-state: 256">{</p>
<p style="text-indent: 0px; margin: 0px; -qt-block-indent: 0; -qt-user-state: 513">/*</p>
<p style="text-indent: 0px; margin: 0px; -qt-block-indent: 0; -qt-user-state: 513">qDebug()&lt;&lt;checked;</p>
<p style="text-indent: 0px; margin: 0px; -qt-block-indent: 0; -qt-user-state: 513">if (!checked){</p>
<p style="text-indent: 0px; margin: 0px; -qt-block-indent: 0; -qt-user-state: 513">this-&gt;update();</p>
<p style="text-indent: 0px; margin: 0px; -qt-block-indent: 0; -qt-user-state: 513">}else{</p>
<p style="text-indent: 0px; margin: 0px; -qt-block-indent: 0; -qt-user-state: 513">this-&gt;update();</p>
<p style="text-indent: 0px; margin: 0px; -qt-block-indent: 0; -qt-user-state: 513">}</p>
<p style="text-indent: 0px; margin: 0px; -qt-block-indent: 0; -qt-user-state: 256">*/</p>
<p style="text-indent: 0px; margin: 0px; -qt-block-indent: 0; -qt-user-state: 0">}</p>
<p style="text-indent: 0px; margin: 0px; -qt-block-indent: 0; -qt-paragraph-type: empty"> </p>
<p>//end</p>
<p>//start</p>
<p>#include &quot;input.h&quot;</p>
<p style="text-indent: 0px; margin: 0px; -qt-block-indent: 0; -qt-user-state: 0">#include &quot;ui_input.h&quot;</p>
<p style="text-indent: 0px; margin: 0px; -qt-block-indent: 0; -qt-paragraph-type: empty"> </p>
<p style="text-indent: 0px; margin: 0px; -qt-block-indent: 0; -qt-user-state: 0">Input::Input(QWidget *parent) :</p>
<p style="text-indent: 0px; margin: 0px; -qt-block-indent: 0; -qt-user-state: 0">QDialog(parent),</p>
<p style="text-indent: 0px; margin: 0px; -qt-block-indent: 0; -qt-user-state: 0">m_ui(new Ui::Input)</p>
<p style="text-indent: 0px; margin: 0px; -qt-block-indent: 0; -qt-user-state: 256">{</p>
<p style="text-indent: 0px; margin: 0px; -qt-block-indent: 0; -qt-user-state: 256">m_ui-&gt;setupUi(this);</p>
<p style="text-indent: 0px; margin: 0px; -qt-block-indent: 0; -qt-user-state: 256">this-&gt;maper=new QDataWidgetMapper();</p>
<p style="text-indent: 0px; margin: 0px; -qt-block-indent: 0; -qt-user-state: 256">this-&gt;conn=QSqlDatabase::database();</p>
<p style="text-indent: 0px; margin: 0px; -qt-block-indent: 0; -qt-user-state: 512">if (!conn.open()){</p>
<p style="text-indent: 0px; margin: 0px; -qt-block-indent: 0; -qt-user-state: 512">qDebug()&lt;&lt;&quot;failed connect mysql&quot;;</p>
<p style="text-indent: 0px; margin: 0px; -qt-block-indent: 0; -qt-user-state: 512">}else{</p>
<p style="text-indent: 0px; margin: 0px; -qt-block-indent: 0; -qt-user-state: 512">model=new QSqlTableModel(this,conn);</p>
<p style="text-indent: 0px; margin: 0px; -qt-block-indent: 0; -qt-user-state: 512">model-&gt;setTable(&quot;stuinfo&quot;);</p>
<p style="text-indent: 0px; margin: 0px; -qt-block-indent: 0; -qt-user-state: 512">model-&gt;setHeaderData(0,Qt::Horizontal,tr(&quot;miaomiaoid&quot;));</p>
<p style="text-indent: 0px; margin: 0px; -qt-block-indent: 0; -qt-user-state: 512">model-&gt;select();</p>
<p style="text-indent: 0px; margin: 0px; -qt-block-indent: 0; -qt-user-state: 512">qDebug()&lt;&lt;model-&gt;rowCount();</p>
<p style="text-indent: 0px; margin: 0px; -qt-block-indent: 0; -qt-user-state: 512">QSqlRecord red= model-&gt;record(0);</p>
<p style="text-indent: 0px; margin: 0px; -qt-block-indent: 0; -qt-user-state: 512">maper-&gt;setSubmitPolicy(maper-&gt;AutoSubmit);</p>
<p style="text-indent: 0px; margin: 0px; -qt-block-indent: 0; -qt-user-state: 512">maper-&gt;setModel(model);</p>
<p style="text-indent: 0px; margin: 0px; -qt-block-indent: 0; -qt-user-state: 512">maper-&gt;addMapping(m_ui-&gt;edname,red.indexOf(&quot;name&quot;));</p>
<p style="text-indent: 0px; margin: 0px; -qt-block-indent: 0; -qt-user-state: 512">maper-&gt;addMapping(m_ui-&gt;edbirth,red.indexOf(&quot;birthday&quot;));</p>
<p style="text-indent: 0px; margin: 0px; -qt-block-indent: 0; -qt-user-state: 512">maper-&gt;addMapping(m_ui-&gt;edcardid,red.indexOf(&quot;cardid&quot;));</p>
<p style="text-indent: 0px; margin: 0px; -qt-block-indent: 0; -qt-user-state: 512">maper-&gt;toFirst();</p>
<p style="text-indent: 0px; margin: 0px; -qt-block-indent: 0; -qt-paragraph-type: empty"> </p>
<p style="text-indent: 0px; margin: 0px; -qt-block-indent: 0; -qt-user-state: 512">QPushButton *but = new QPushButton(&quot;miao&quot;);</p>
<p style="text-indent: 0px; margin: 0px; -qt-block-indent: 0; -qt-user-state: 512">but-&gt;setParent(this);</p>
<p style="text-indent: 0px; margin: 0px; -qt-block-indent: 0; -qt-user-state: 512">but-&gt;show();</p>
<p style="text-indent: 0px; margin: 0px; -qt-block-indent: 0; -qt-user-state: 512">but-&gt;move(100,200);</p>
<p style="text-indent: 0px; margin: 0px; -qt-block-indent: 0; -qt-user-state: 512">connect(but,SIGNAL(clicked()),model,SLOT(submit()));</p>
<p style="text-indent: 0px; margin: 0px; -qt-block-indent: 0; -qt-user-state: 512">connect(but,SIGNAL(clicked()),maper,SLOT(submit()));</p>
<p style="text-indent: 0px; margin: 0px; -qt-block-indent: 0; -qt-user-state: 256">}</p>
<p style="text-indent: 0px; margin: 0px; -qt-block-indent: 0; -qt-user-state: 0">}</p>
<p style="text-indent: 0px; margin: 0px; -qt-block-indent: 0; -qt-paragraph-type: empty"> </p>
<p style="text-indent: 0px; margin: 0px; -qt-block-indent: 0; -qt-user-state: 0">Input::~Input()</p>
<p style="text-indent: 0px; margin: 0px; -qt-block-indent: 0; -qt-user-state: 256">{</p>
<p style="text-indent: 0px; margin: 0px; -qt-block-indent: 0; -qt-user-state: 256">delete m_ui;</p>
<p style="text-indent: 0px; margin: 0px; -qt-block-indent: 0; -qt-user-state: 0">}</p>
<p style="text-indent: 0px; margin: 0px; -qt-block-indent: 0; -qt-paragraph-type: empty"> </p>
<p style="text-indent: 0px; margin: 0px; -qt-block-indent: 0; -qt-user-state: 0">void Input::changeEvent(QEvent *e)</p>
<p style="text-indent: 0px; margin: 0px; -qt-block-indent: 0; -qt-user-state: 256">{</p>
<p style="text-indent: 0px; margin: 0px; -qt-block-indent: 0; -qt-user-state: 256">QDialog::changeEvent(e);</p>
<p style="text-indent: 0px; margin: 0px; -qt-block-indent: 0; -qt-user-state: 512">switch (e-&gt;type()) {</p>
<p style="text-indent: 0px; margin: 0px; -qt-block-indent: 0; -qt-user-state: 512">case QEvent::LanguageChange:</p>
<p style="text-indent: 0px; margin: 0px; -qt-block-indent: 0; -qt-user-state: 512">m_ui-&gt;retranslateUi(this);</p>
<p style="text-indent: 0px; margin: 0px; -qt-block-indent: 0; -qt-user-state: 512">break;</p>
<p style="text-indent: 0px; margin: 0px; -qt-block-indent: 0; -qt-user-state: 512">default:</p>
<p style="text-indent: 0px; margin: 0px; -qt-block-indent: 0; -qt-user-state: 512">break;</p>
<p style="text-indent: 0px; margin: 0px; -qt-block-indent: 0; -qt-user-state: 256">}</p>
<p style="text-indent: 0px; margin: 0px; -qt-block-indent: 0; -qt-user-state: 0">}</p>
<p style="text-indent: 0px; margin: 0px; -qt-block-indent: 0; -qt-paragraph-type: empty"> </p>
<p>//end</p>
<p>//start</p>
<p>#include &lt;QtGui/QApplication&gt;</p>
<p style="text-indent: 0px; margin: 0px; -qt-block-indent: 0; -qt-user-state: 0">#include &quot;stuin.h&quot;</p>
<p style="text-indent: 0px; margin: 0px; -qt-block-indent: 0; -qt-user-state: 0">#include &quot;input.h&quot;</p>
<p style="text-indent: 0px; margin: 0px; -qt-block-indent: 0; -qt-user-state: 0">#include &lt;QSqlDatabase&gt;</p>
<p style="text-indent: 0px; margin: 0px; -qt-block-indent: 0; -qt-user-state: 0">int main(int argc, char *argv[])</p>
<p style="text-indent: 0px; margin: 0px; -qt-block-indent: 0; -qt-user-state: 256">{</p>
<p style="text-indent: 0px; margin: 0px; -qt-block-indent: 0; -qt-user-state: 256">QApplication a(argc, argv);</p>
<p style="text-indent: 0px; margin: 0px; -qt-block-indent: 0; -qt-user-state: 256">QSqlDatabase conn= QSqlDatabase::addDatabase(&quot;QMYSQL&quot;);</p>
<p style="text-indent: 0px; margin: 0px; -qt-block-indent: 0; -qt-user-state: 256">conn.setUserName(&quot;root&quot;);</p>
<p style="text-indent: 0px; margin: 0px; -qt-block-indent: 0; -qt-user-state: 256">conn.setPassword(&quot;admin&quot;);</p>
<p style="text-indent: 0px; margin: 0px; -qt-block-indent: 0; -qt-user-state: 256">conn.setHostName(&quot;127.0.0.1&quot;);</p>
<p style="text-indent: 0px; margin: 0px; -qt-block-indent: 0; -qt-user-state: 256">conn.setDatabaseName(&quot;yjytutor&quot;);</p>
<p style="text-indent: 0px; margin: 0px; -qt-block-indent: 0; -qt-user-state: 256">Stuin w;</p>
<p style="text-indent: 0px; margin: 0px; -qt-block-indent: 0; -qt-user-state: 256">w.show();</p>
<p style="text-indent: 0px; margin: 0px; -qt-block-indent: 0; -qt-user-state: 256">// Input w1;</p>
<p style="text-indent: 0px; margin: 0px; -qt-block-indent: 0; -qt-user-state: 256">// w1.show();</p>
<p style="text-indent: 0px; margin: 0px; -qt-block-indent: 0; -qt-user-state: 256">return a.exec();</p>
<p style="text-indent: 0px; margin: 0px; -qt-block-indent: 0; -qt-user-state: 0">}</p>
<p style="text-indent: 0px; margin: 0px; -qt-block-indent: 0; -qt-paragraph-type: empty"> </p>
<p>//end</p> <a href="http://hi.baidu.com/yjy2410578/blog/item/f5fb75133727768a6438db2b.html">阅读全文</a>
		
		<br/><b>类别：</b><a href="http://hi.baidu.com/yjy2410578/blog/category/Qt">Qt</a>&nbsp;<a href="http://hi.baidu.com/yjy2410578/blog/item/f5fb75133727768a6438db2b.html#comment">查看评论</a>]]></description>
        <pubDate>2009-11-19  19:04</pubDate>
        <category><![CDATA[Qt]]></category>
        <author><![CDATA[yjy2410578]]></author>
		<guid>http://hi.baidu.com/yjy2410578/blog/item/f5fb75133727768a6438db2b.html</guid>
</item>

<item>
        <title><![CDATA[qt 自定义model]]></title>
        <link><![CDATA[http://hi.baidu.com/yjy2410578/blog/item/eadebf82263768a80df4d212.html]]></link>
        <description><![CDATA[
		
		#include &quot;strmod.h&quot;
<p style="text-indent: 0px; margin: 0px; -qt-block-indent: 0; -qt-user-state: 256">int strmod ::rowCount(const QModelIndex &amp;parent) const{</p>
<p style="text-indent: 0px; margin: 0px; -qt-block-indent: 0; -qt-user-state: 256">return this-&gt;stringList.count();</p>
<p style="text-indent: 0px; margin: 0px; -qt-block-indent: 0; -qt-user-state: 0">}</p>
<p style="text-indent: 0px; margin: 0px; -qt-block-indent: 0; -qt-user-state: 256">QVariant strmod::data(const QModelIndex &amp;index, int role) const{</p>
<p style="text-indent: 0px; margin: 0px; -qt-block-indent: 0; -qt-user-state: 256">if (!index.isValid())</p>
<p style="text-indent: 0px; margin: 0px; -qt-block-indent: 0; -qt-user-state: 256">return QVariant();</p>
<p style="text-indent: 0px; margin: 0px; -qt-block-indent: 0; -qt-user-state: 512">if (index.row()&gt;stringList.count()){</p>
<p style="text-indent: 0px; margin: 0px; -qt-block-indent: 0; -qt-user-state: 512">return QVariant();</p>
<p style="text-indent: 0px; margin: 0px; -qt-block-indent: 0; -qt-user-state: 256">}</p>
<p style="text-indent: 0px; margin: 0px; -qt-block-indent: 0; -qt-user-state: 512">if (role==Qt::DisplayRole){</p>
<p style="text-indent: 0px; margin: 0px; -qt-block-indent: 0; -qt-user-state: 512">return stringList.at(index.row());</p>
<p style="text-indent: 0px; margin: 0px; -qt-block-indent: 0; -qt-user-state: 512">}else{</p>
<p style="text-indent: 0px; margin: 0px; -qt-block-indent: 0; -qt-user-state: 512">return QVariant();</p>
<p style="text-indent: 0px; margin: 0px; -qt-block-indent: 0; -qt-user-state: 256">}</p>
<p style="text-indent: 0px; margin: 0px; -qt-block-indent: 0; -qt-user-state: 0">}</p>
<p style="text-indent: 0px; margin: 0px; -qt-block-indent: 0; -qt-user-state: 0">QVariant strmod::headerData(int section, Qt::Orientation orientation,</p>
<p style="text-indent: 0px; margin: 0px; -qt-block-indent: 0; -qt-user-state: 256">int role ) const{</p>
<p style="text-indent: 0px; margin: 0px; -qt-block-indent: 0; -qt-user-state: 512">if (role==Qt::DisplayRole){</p>
<p style="text-indent: 0px; margin: 0px; -qt-block-indent: 0; -qt-user-state: 768">if (orientation == Qt::Horizontal){</p>
<p style="text-indent: 0px; margin: 0px; -qt-block-indent: 0; -qt-user-state: 768">return QString(&quot;col: %1&quot;).arg(section);</p>
<p style="text-indent: 0px; margin: 0px; -qt-block-indent: 0; -qt-user-state: 768">}else{</p>
<p style="text-indent: 0px; margin: 0px; -qt-block-indent: 0; -qt-user-state: 768">return QString(&quot;%1&quot;).arg(char(section+'A'));</p>
<p style="text-indent: 0px; margin: 0px; -qt-block-indent: 0; -qt-user-state: 512">}</p>
<p style="text-indent: 0px; margin: 0px; -qt-block-indent: 0; -qt-user-state: 512">}else{</p>
<p style="text-indent: 0px; margin: 0px; -qt-block-indent: 0; -qt-user-state: 512">return QVariant();</p>
<p style="text-indent: 0px; margin: 0px; -qt-block-indent: 0; -qt-user-state: 256">}</p>
<p style="text-indent: 0px; margin: 0px; -qt-block-indent: 0; -qt-user-state: 0">}</p>
<p style="text-indent: 0px; margin: 0px; -qt-block-indent: 0; -qt-paragraph-type: empty"> </p>
<p style="text-indent: 0px; margin: 0px; -qt-block-indent: 0; -qt-user-state: 256">Qt::ItemFlags strmod::flags(const QModelIndex &amp;index) const{</p>
<p style="text-indent: 0px; margin: 0px; -qt-block-indent: 0; -qt-user-state: 256">if (!index.isValid())</p>
<p style="text-indent: 0px; margin: 0px; -qt-block-indent: 0; -qt-user-state: 256">return Qt::ItemIsEnabled;</p>
<p style="text-indent: 0px; margin: 0px; -qt-block-indent: 0; -qt-user-state: 256">return (QAbstractItemModel::flags(index)|Qt::ItemIsEditable);</p>
<p style="text-indent: 0px; margin: 0px; -qt-block-indent: 0; -qt-user-state: 0">}</p>
<p style="text-indent: 0px; margin: 0px; -qt-block-indent: 0; -qt-user-state: 0">bool strmod::setData(const QModelIndex &amp;index, const QVariant &amp;value,</p>
<p style="text-indent: 0px; margin: 0px; -qt-block-indent: 0; -qt-user-state: 256">int role ){</p>
<p style="text-indent: 0px; margin: 0px; -qt-block-indent: 0; -qt-user-state: 512">if (index.isValid()&amp;&amp;role== Qt::EditRole &amp;&amp;!value.toString().isEmpty()){ //避免选中时把原值抹掉</p>
<p style="text-indent: 0px; margin: 0px; -qt-block-indent: 0; -qt-user-state: 512">this-&gt;stringList.replace(index.row(),value.toString());</p>
<p style="text-indent: 0px; margin: 0px; -qt-block-indent: 0; -qt-user-state: 512">emit this-&gt;dataChanged(index,index);</p>
<p style="text-indent: 0px; margin: 0px; -qt-block-indent: 0; -qt-user-state: 512">return true;</p>
<p style="text-indent: 0px; margin: 0px; -qt-block-indent: 0; -qt-user-state: 256">}</p>
<p style="text-indent: 0px; margin: 0px; -qt-block-indent: 0; -qt-user-state: 256">return false;</p>
<p style="text-indent: 0px; margin: 0px; -qt-block-indent: 0; -qt-paragraph-type: empty"> </p>
<p style="text-indent: 0px; margin: 0px; -qt-block-indent: 0; -qt-user-state: 0">}</p>
<p style="text-indent: 0px; margin: 0px; -qt-block-indent: 0; -qt-paragraph-type: empty"> </p>
<p style="text-indent: 0px; margin: 0px; -qt-block-indent: 0; -qt-user-state: 256">bool strmod::insertRows(int position, int rows, const QModelIndex &amp;index ){</p>
<p style="text-indent: 0px; margin: 0px; -qt-block-indent: 0; -qt-user-state: 256">beginInsertRows(QModelIndex(), position, position+rows-1);</p>
<p style="text-indent: 0px; margin: 0px; -qt-block-indent: 0; -qt-paragraph-type: empty"> </p>
<p style="text-indent: 0px; margin: 0px; -qt-block-indent: 0; -qt-user-state: 512">for (int row = 0; row &lt; rows; ++row) {</p>
<p style="text-indent: 0px; margin: 0px; -qt-block-indent: 0; -qt-user-state: 512">stringList.insert(position, &quot;&quot;);</p>
<p style="text-indent: 0px; margin: 0px; -qt-block-indent: 0; -qt-user-state: 256">}</p>
<p style="text-indent: 0px; margin: 0px; -qt-block-indent: 0; -qt-paragraph-type: empty"> </p>
<p style="text-indent: 0px; margin: 0px; -qt-block-indent: 0; -qt-user-state: 256">endInsertRows();</p>
<p style="text-indent: 0px; margin: 0px; -qt-block-indent: 0; -qt-user-state: 256">return true;</p>
<p style="text-indent: 0px; margin: 0px; -qt-block-indent: 0; -qt-user-state: 0">}</p>
<p style="text-indent: 0px; margin: 0px; -qt-block-indent: 0; -qt-user-state: 256">bool strmod::removeRows(int position, int rows, const QModelIndex &amp;index ){</p>
<p style="text-indent: 0px; margin: 0px; -qt-block-indent: 0; -qt-user-state: 256">beginInsertRows(QModelIndex(), position, position+rows-1);</p>
<p style="text-indent: 0px; margin: 0px; -qt-block-indent: 0; -qt-paragraph-type: empty"> </p>
<p style="text-indent: 0px; margin: 0px; -qt-block-indent: 0; -qt-user-state: 512">for (int row = 0; row &lt; rows; ++row) {</p>
<p style="text-indent: 0px; margin: 0px; -qt-block-indent: 0; -qt-user-state: 512">stringList.insert(position, &quot;&quot;);</p>
<p style="text-indent: 0px; margin: 0px; -qt-block-indent: 0; -qt-user-state: 256">}</p>
<p style="text-indent: 0px; margin: 0px; -qt-block-indent: 0; -qt-paragraph-type: empty"> </p>
<p style="text-indent: 0px; margin: 0px; -qt-block-indent: 0; -qt-user-state: 256">endInsertRows();</p>
<p style="text-indent: 0px; margin: 0px; -qt-block-indent: 0; -qt-user-state: 256">return true;</p>
<p style="text-indent: 0px; margin: 0px; -qt-block-indent: 0; -qt-user-state: 0">}</p>
<p style="text-indent: 0px; margin: 0px; -qt-block-indent: 0; -qt-paragraph-type: empty"> </p> <a href="http://hi.baidu.com/yjy2410578/blog/item/eadebf82263768a80df4d212.html">阅读全文</a>
		
		<br/><b>类别：</b><a href="http://hi.baidu.com/yjy2410578/blog/category/Qt">Qt</a>&nbsp;<a href="http://hi.baidu.com/yjy2410578/blog/item/eadebf82263768a80df4d212.html#comment">查看评论</a>]]></description>
        <pubDate>2009-11-18  11:42</pubDate>
        <category><![CDATA[Qt]]></category>
        <author><![CDATA[yjy2410578]]></author>
		<guid>http://hi.baidu.com/yjy2410578/blog/item/eadebf82263768a80df4d212.html</guid>
</item>

<item>
        <title><![CDATA[qt thread]]></title>
        <link><![CDATA[http://hi.baidu.com/yjy2410578/blog/item/2ac8a94a7fc6fe2908f7ef3c.html]]></link>
        <description><![CDATA[
		
		#include &quot;mythread.h&quot;
<p style="text-indent: 0px; margin: 0px; -qt-block-indent: 0; -qt-paragraph-type: empty"> </p>
<p style="text-indent: 0px; margin: 0px; -qt-block-indent: 0; -qt-user-state: 0">Mythread::Mythread(QString myfn)</p>
<p style="text-indent: 0px; margin: 0px; -qt-block-indent: 0; -qt-user-state: 256">{</p>
<p style="text-indent: 0px; margin: 0px; -qt-block-indent: 0; -qt-user-state: 256">this-&gt;fn=myfn;</p>
<p style="text-indent: 0px; margin: 0px; -qt-block-indent: 0; -qt-user-state: 0">}</p>
<p style="text-indent: 0px; margin: 0px; -qt-block-indent: 0; -qt-user-state: 256">void Mythread::run(){</p>
<p style="text-indent: 0px; margin: 0px; -qt-block-indent: 0; -qt-user-state: 256">qDebug()&lt;&lt;&quot;thread start: reading&quot;&lt;&lt;this-&gt;fn;</p>
<p style="text-indent: 0px; margin: 0px; -qt-block-indent: 0; -qt-user-state: 512">if (!fn.isEmpty()){</p>
<p style="text-indent: 0px; margin: 0px; -qt-block-indent: 0; -qt-user-state: 512">QFile fi(fn);</p>
<p style="text-indent: 0px; margin: 0px; -qt-block-indent: 0; -qt-user-state: 768">if (!fi.open(QIODevice::ReadOnly)){</p>
<p style="text-indent: 0px; margin: 0px; -qt-block-indent: 0; -qt-user-state: 768">qDebug()&lt;&lt;fi.errorString();</p>
<p style="text-indent: 0px; margin: 0px; -qt-block-indent: 0; -qt-user-state: 768">}else{</p>
<p style="text-indent: 0px; margin: 0px; -qt-block-indent: 0; -qt-user-state: 768">qDebug()&lt;&lt;&quot;reading file&quot;;</p>
<p style="text-indent: 0px; margin: 0px; -qt-block-indent: 0; -qt-user-state: 768">QTextStream fin(&amp;fi);</p>
<p style="text-indent: 0px; margin: 0px; -qt-block-indent: 0; -qt-user-state: 768">fin.setCodec(&quot;UTF-8&quot;);</p>
<p style="text-indent: 0px; margin: 0px; -qt-block-indent: 0; -qt-user-state: 768">QStringList strlist;</p>
<p style="text-indent: 0px; margin: 0px; -qt-block-indent: 0; -qt-user-state: 768">QString line;</p>
<p style="text-indent: 0px; margin: 0px; -qt-block-indent: 0; -qt-user-state: 1024">while (!fin.atEnd()){</p>
<p style="text-indent: 0px; margin: 0px; -qt-block-indent: 0; -qt-user-state: 1024">line=fin.readLine();</p>
<p style="text-indent: 0px; margin: 0px; -qt-block-indent: 0; -qt-user-state: 1024">strlist.push_back(line);</p>
<p style="text-indent: 0px; margin: 0px; -qt-block-indent: 0; -qt-user-state: 768">}</p>
<p style="text-indent: 0px; margin: 0px; -qt-block-indent: 0; -qt-user-state: 768">// qDebug()&lt;&lt;strlist;</p>
<p style="text-indent: 0px; margin: 0px; -qt-block-indent: 0; -qt-user-state: 768">emit this-&gt;passstrlist(strlist);</p>
<p style="text-indent: 0px; margin: 0px; -qt-block-indent: 0; -qt-user-state: 512">}</p>
<p style="text-indent: 0px; margin: 0px; -qt-block-indent: 0; -qt-user-state: 256">}</p>
<p style="text-indent: 0px; margin: 0px; -qt-block-indent: 0; -qt-user-state: 0">}</p>
<p style="text-indent: 0px; margin: 0px; -qt-block-indent: 0; -qt-paragraph-type: empty"> </p>
<p style="text-indent: 0px; margin: 0px; -qt-block-indent: 0; -qt-paragraph-type: empty"> </p>
<p style="text-indent: 0px; margin: 0px; -qt-block-indent: 0; -qt-paragraph-type: empty"> </p> <a href="http://hi.baidu.com/yjy2410578/blog/item/2ac8a94a7fc6fe2908f7ef3c.html">阅读全文</a>
		
		<br/><b>类别：</b><a href="http://hi.baidu.com/yjy2410578/blog/category/Qt">Qt</a>&nbsp;<a href="http://hi.baidu.com/yjy2410578/blog/item/2ac8a94a7fc6fe2908f7ef3c.html#comment">查看评论</a>]]></description>
        <pubDate>2009-11-18  11:03</pubDate>
        <category><![CDATA[Qt]]></category>
        <author><![CDATA[yjy2410578]]></author>
		<guid>http://hi.baidu.com/yjy2410578/blog/item/2ac8a94a7fc6fe2908f7ef3c.html</guid>
</item>

<item>
        <title><![CDATA[dir model tree view]]></title>
        <link><![CDATA[http://hi.baidu.com/yjy2410578/blog/item/38d481092a5cc8c53ac76333.html]]></link>
        <description><![CDATA[
		
		#include &lt;QtGui/QApplication&gt;
<p style="text-indent: 0px; margin: 0px; -qt-block-indent: 0; -qt-user-state: 0">#include &lt;QSplitter&gt;</p>
<p style="text-indent: 0px; margin: 0px; -qt-block-indent: 0; -qt-user-state: 0">#include &lt;QDirModel&gt;</p>
<p style="text-indent: 0px; margin: 0px; -qt-block-indent: 0; -qt-user-state: 0">#include &lt;QTreeView&gt;</p>
<p style="text-indent: 0px; margin: 0px; -qt-block-indent: 0; -qt-user-state: 0">#include &lt;QListView&gt;</p>
<p style="text-indent: 0px; margin: 0px; -qt-block-indent: 0; -qt-user-state: 0">#include &lt;QDebug&gt;</p>
<p style="text-indent: 0px; margin: 0px; -qt-block-indent: 0; -qt-user-state: 0">int main(int argc, char *argv[])</p>
<p style="text-indent: 0px; margin: 0px; -qt-block-indent: 0; -qt-user-state: 256">{</p>
<p style="text-indent: 0px; margin: 0px; -qt-block-indent: 0; -qt-user-state: 256">QApplication a(argc, argv);</p>
<p style="text-indent: 0px; margin: 0px; -qt-block-indent: 0; -qt-user-state: 256">QSplitter *frame = new QSplitter(Qt::Horizontal);</p>
<p style="text-indent: 0px; margin: 0px; -qt-block-indent: 0; -qt-user-state: 256">QDirModel * dirmod =new QDirModel();</p>
<p style="text-indent: 0px; margin: 0px; -qt-block-indent: 0; -qt-user-state: 256">QTreeView * tree =new QTreeView(frame);</p>
<p style="text-indent: 0px; margin: 0px; -qt-block-indent: 0; -qt-user-state: 256">tree-&gt;setModel(dirmod);</p>
<p style="text-indent: 0px; margin: 0px; -qt-block-indent: 0; -qt-user-state: 256">tree-&gt;setRootIndex(dirmod-&gt;index(QDir::homePath()));</p>
<p style="text-indent: 0px; margin: 0px; -qt-block-indent: 0; -qt-user-state: 256">QListView * list = new QListView(frame);</p>
<p style="text-indent: 0px; margin: 0px; -qt-block-indent: 0; -qt-user-state: 256">list-&gt;setModel(dirmod);</p>
<p style="text-indent: 0px; margin: 0px; -qt-block-indent: 0; -qt-user-state: 256">list-&gt;setRootIndex(dirmod-&gt;index(QDir::homePath()));</p>
<p style="text-indent: 0px; margin: 0px; -qt-block-indent: 0; -qt-user-state: 256">int len = dirmod-&gt;rowCount();</p>
<p style="text-indent: 0px; margin: 0px; -qt-block-indent: 0; -qt-user-state: 256">QModelIndex par =dirmod-&gt;index(QDir::homePath());</p>
<p style="text-indent: 0px; margin: 0px; -qt-block-indent: 0; -qt-user-state: 256">// dirmod-&gt;sort(2,Qt::AscendingOrder);</p>
<p style="text-indent: 0px; margin: 0px; -qt-block-indent: 0; -qt-user-state: 512">for (int i=0;i&lt;len;i++){</p>
<p style="text-indent: 0px; margin: 0px; -qt-block-indent: 0; -qt-user-state: 512">QModelIndex ind = dirmod-&gt;index(i,2,par); // col size filetype</p>
<p style="text-indent: 0px; margin: 0px; -qt-block-indent: 0; -qt-user-state: 512">QString txt = dirmod-&gt;data(ind,Qt::DisplayRole).toString();</p>
<p style="text-indent: 0px; margin: 0px; -qt-block-indent: 0; -qt-user-state: 512">qDebug()&lt;&lt;txt;</p>
<p style="text-indent: 0px; margin: 0px; -qt-block-indent: 0; -qt-user-state: 256">}</p>
<p style="text-indent: 0px; margin: 0px; -qt-block-indent: 0; -qt-user-state: 256">frame-&gt;show();</p>
<p style="text-indent: 0px; margin: 0px; -qt-block-indent: 0; -qt-user-state: 256">return a.exec();</p>
<p style="text-indent: 0px; margin: 0px; -qt-block-indent: 0; -qt-user-state: 0">}</p>
<p style="text-indent: 0px; margin: 0px; -qt-block-indent: 0; -qt-paragraph-type: empty"> </p> <a href="http://hi.baidu.com/yjy2410578/blog/item/38d481092a5cc8c53ac76333.html">阅读全文</a>
		
		<br/><b>类别：</b><a href="http://hi.baidu.com/yjy2410578/blog/category/Qt">Qt</a>&nbsp;<a href="http://hi.baidu.com/yjy2410578/blog/item/38d481092a5cc8c53ac76333.html#comment">查看评论</a>]]></description>
        <pubDate>2009-11-18  11:02</pubDate>
        <category><![CDATA[Qt]]></category>
        <author><![CDATA[yjy2410578]]></author>
		<guid>http://hi.baidu.com/yjy2410578/blog/item/38d481092a5cc8c53ac76333.html</guid>
</item>

<item>
        <title><![CDATA[qt 启动 login]]></title>
        <link><![CDATA[http://hi.baidu.com/yjy2410578/blog/item/693745cce3403a1a00e928eb.html]]></link>
        <description><![CDATA[
		
		#include &lt;QtGui/QApplication&gt;
<p style="text-indent: 0px; margin: 0px; -qt-block-indent: 0; -qt-user-state: 0">#include &quot;mainwindow.h&quot;</p>
<p style="text-indent: 0px; margin: 0px; -qt-block-indent: 0; -qt-user-state: 0">#include &quot;login.h&quot;</p>
<p style="text-indent: 0px; margin: 0px; -qt-block-indent: 0; -qt-user-state: 0">#include &lt;QDebug&gt;</p>
<p style="text-indent: 0px; margin: 0px; -qt-block-indent: 0; -qt-user-state: 0">int main(int argc, char *argv[])</p>
<p style="text-indent: 0px; margin: 0px; -qt-block-indent: 0; -qt-user-state: 256">{</p>
<p style="text-indent: 0px; margin: 0px; -qt-block-indent: 0; -qt-user-state: 256">QApplication a(argc, argv);</p>
<p style="text-indent: 0px; margin: 0px; -qt-block-indent: 0; -qt-user-state: 256">Login log;</p>
<p style="text-indent: 0px; margin: 0px; -qt-block-indent: 0; -qt-user-state: 256">MainWindow w;</p>
<p style="text-indent: 0px; margin: 0px; -qt-block-indent: 0; -qt-user-state: 256">int ret =log.exec();</p>
<p style="text-indent: 0px; margin: 0px; -qt-block-indent: 0; -qt-paragraph-type: empty"> </p>
<p style="text-indent: 0px; margin: 0px; -qt-block-indent: 0; -qt-user-state: 512">if (ret==5){</p>
<p style="text-indent: 0px; margin: 0px; -qt-block-indent: 0; -qt-user-state: 512">qDebug()&lt;&lt;&quot;miao &quot;&lt;&lt;ret;</p>
<p style="text-indent: 0px; margin: 0px; -qt-block-indent: 0; -qt-user-state: 512">w.show();</p>
<p style="text-indent: 0px; margin: 0px; -qt-block-indent: 0; -qt-user-state: 256">}</p>
<p style="text-indent: 0px; margin: 0px; -qt-block-indent: 0; -qt-user-state: 256">return a.exec();</p>
<p style="text-indent: 0px; margin: 0px; -qt-block-indent: 0; -qt-user-state: 0">}</p>
<p style="text-indent: 0px; margin: 0px; -qt-block-indent: 0; -qt-user-state: 0"> </p>
<p style="text-indent: 0px; margin: 0px; -qt-block-indent: 0; -qt-user-state: 0"><font color="#ff0000"> this-&gt;done(5);</font></p>
<p style="text-indent: 0px; margin: 0px; -qt-block-indent: 0; -qt-paragraph-type: empty"> </p> <a href="http://hi.baidu.com/yjy2410578/blog/item/693745cce3403a1a00e928eb.html">阅读全文</a>
		
		<br/><b>类别：</b><a href="http://hi.baidu.com/yjy2410578/blog/category/Qt">Qt</a>&nbsp;<a href="http://hi.baidu.com/yjy2410578/blog/item/693745cce3403a1a00e928eb.html#comment">查看评论</a>]]></description>
        <pubDate>2009-11-17  22:22</pubDate>
        <category><![CDATA[Qt]]></category>
        <author><![CDATA[yjy2410578]]></author>
		<guid>http://hi.baidu.com/yjy2410578/blog/item/693745cce3403a1a00e928eb.html</guid>
</item>

<item>
        <title><![CDATA[zju 3261 MLE]]></title>
        <link><![CDATA[http://hi.baidu.com/yjy2410578/blog/item/d03747443a19ea88b3b7dc47.html]]></link>
        <description><![CDATA[
		
		<p>#include &lt;stdio.h&gt;<br>
#include &lt;string.h&gt;<br>
#include &lt;iostream&gt;<br>
#include &lt;algorithm&gt;<br>
#include &lt;vector&gt;<br>
#include &lt;map&gt;<br>
using namespace std;<br>
const int SIZE = 40010;<br>
const int LEN = 10010;<br>
const int NDSZ = LEN*2;<br>
class Edge{<br>
public:<br>
 int fr,to;<br>
 Edge(int f=0,int t=0):fr(f),to(t){};<br>
};<br>
Edge edat[SIZE];<br>
Edge * front[SIZE];</p>
<p>int ext;<br>
class Node{<br>
public:<br>
 int nowid;<br>
 int frst,fred;<br>
 vector&lt;int&gt; conn;<br>
 int sp;<br>
 int val;<br>
 void set(int id , int v){<br>
&nbsp;&nbsp; nowid=id;<br>
&nbsp;&nbsp; val=v;<br>
&nbsp;&nbsp; sp=0;<br>
&nbsp;&nbsp; conn.clear();<br>
&nbsp;&nbsp; frst=fred=0;<br>
 }<br>
 void rename(){<br>
&nbsp;&nbsp; nowid=ext++;<br>
 }<br>
};<br>
Node dat[LEN];</p>
<p>int fa[NDSZ];<br>
void merge(int ,int);<br>
int find(int);<br>
void init();<br>
int n,m;<br>
bool cmpfr(const Edge * a,const Edge * b);<br>
bool cmpbk(const Edge * a,const Edge * b);<br>
bool cmpnd(const int &amp; a , const int &amp; b);<br>
void work();<br>
void prework();<br>
int gethelp(int);<br>
void mkrel(int ,int);<br>
int main(){<br>
 //freopen(&quot;../../dat.in&quot;,&quot;r&quot;,stdin);<br>
 bool fir=true;<br>
 while (scanf(&quot;%d&quot;,&amp;n)!=EOF){<br>
&nbsp;&nbsp; init();<br>
&nbsp;&nbsp; if (fir){<br>
&nbsp;&nbsp;&nbsp; fir=false;<br>
&nbsp;&nbsp; }else{<br>
&nbsp;&nbsp;&nbsp; printf(&quot;\n&quot;);<br>
&nbsp;&nbsp; }<br>
&nbsp;&nbsp; work();<br>
 }<br>
 return 0;<br>
}</p>
<p>void init(){<br>
 ext=n;<br>
 int i,j;<br>
 for (i=0;i&lt;n*2;i++){<br>
&nbsp;&nbsp; fa[i]=i;<br>
 }<br>
 for (i=0;i&lt;n;i++){<br>
&nbsp;&nbsp; int val;<br>
&nbsp;&nbsp; scanf(&quot;%d&quot;,&amp;val);<br>
&nbsp;&nbsp; dat[i].set(i,val);<br>
 }<br>
 scanf(&quot;%d&quot;,&amp;m);<br>
 int tmp=0;<br>
 for (i=0;i&lt;m;i++){<br>
&nbsp;&nbsp; int fr,to;<br>
&nbsp;&nbsp; scanf(&quot;%d%d&quot;,&amp;fr,&amp;to);<br>
&nbsp;&nbsp; edat[tmp++]=Edge(fr,to);<br>
&nbsp;&nbsp; edat[tmp++]=Edge(to,fr);<br>
&nbsp;&nbsp; merge(fr,to);<br>
 }<br>
 m=tmp;<br>
 for (i=0;i&lt;m;i++){<br>
&nbsp;&nbsp; front[i]=&amp;edat[i];<br>
 }<br>
 sort(front,front+m,cmpfr);<br>
 int last=front[0]-&gt;fr;<br>
 dat[last].frst=0;<br>
 for (i=1;i&lt;m;i++){<br>
&nbsp;&nbsp; if (last!=front[i]-&gt;fr){<br>
&nbsp;&nbsp;&nbsp; dat[last].fred=i;<br>
&nbsp;&nbsp;&nbsp; last=front[i]-&gt;fr;<br>
&nbsp;&nbsp;&nbsp; dat[last].frst=i;<br>
&nbsp;&nbsp; }<br>
 }<br>
 dat[last].fred=i;<br>
 <br>
 prework();<br>
}</p>
<p>bool cmpfr(const Edge * a,const Edge * b){<br>
 return (a-&gt;fr!=b-&gt;fr)?(a-&gt;fr&lt;b-&gt;fr):(a-&gt;to&lt;b-&gt;to);<br>
}<br>
bool cmpbk(const Edge * a,const Edge * b){<br>
 return (a-&gt;to!=b-&gt;to)?(a-&gt;to&lt;b-&gt;to):(a-&gt;fr&lt;b-&gt;fr);<br>
}<br>
bool cmpnd(const int &amp; a , const int &amp; b){<br>
 return (dat[a].val!=dat[b].val)?(dat[a].val&gt;dat[b].val):(a&lt;b);<br>
}<br>
void work(){<br>
 int cas;<br>
 scanf(&quot;%d&quot;,&amp;cas);<br>
 <br>
 while (cas--){<br>
&nbsp;&nbsp; char buff[20];<br>
&nbsp;&nbsp; scanf(&quot;%s&quot;,buff);<br>
&nbsp;&nbsp; if (buff[0]=='q'){<br>
&nbsp;&nbsp;&nbsp; int nd;<br>
&nbsp;&nbsp;&nbsp; scanf(&quot;%d&quot;,&amp;nd);<br>
&nbsp;&nbsp;&nbsp; int ans = gethelp(nd);<br>
&nbsp;&nbsp;&nbsp; printf(&quot;%d\n&quot;,ans);<br>
&nbsp;&nbsp; }else if (buff[0]='d'){<br>
&nbsp;&nbsp;&nbsp; int fr,to;<br>
&nbsp;&nbsp;&nbsp; scanf(&quot;%d%d&quot;,&amp;fr,&amp;to);<br>
&nbsp;&nbsp;&nbsp; dat[fr].rename();<br>
&nbsp;&nbsp;&nbsp; dat[to].rename();<br>
&nbsp;&nbsp;&nbsp; mkrel(fr , to);<br>
&nbsp;&nbsp;&nbsp; mkrel(to ,fr);<br>
&nbsp;&nbsp; }<br>
 }<br>
}</p>
<p>void merge(int a,int b){<br>
 int na = find(a);<br>
 int nb = find(b);<br>
 if (na==nb)return ;<br>
 fa[na]=nb;<br>
}<br>
int find(int nd){<br>
 return (nd==fa[nd])?(nd):(fa[nd]=find(fa[nd]));<br>
}<br>
void prework(){<br>
 int i,j;<br>
 for (i=0;i&lt;n;i++)<br>
&nbsp;&nbsp; for (j=i+1;j&lt;n;j++){<br>
&nbsp;&nbsp;&nbsp; int na = i;<br>
&nbsp;&nbsp;&nbsp; int nb = j;<br>
&nbsp;&nbsp;&nbsp; if (find(na)==find(nb)){<br>
&nbsp;&nbsp;&nbsp;&nbsp; if (dat[na].val&gt;dat[nb].val){<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; dat[nb].conn.push_back(na);<br>
&nbsp;&nbsp;&nbsp;&nbsp; }else if (dat[na].val&lt;dat[nb].val){<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; dat[na].conn.push_back(nb);<br>
&nbsp;&nbsp;&nbsp;&nbsp; }<br>
&nbsp;&nbsp;&nbsp; }<br>
&nbsp;&nbsp; }<br>
 for (i=0;i&lt;n;i++){<br>
&nbsp;&nbsp; sort(dat[i].conn.begin() , dat[i].conn.end() , cmpnd);<br>
 }<br>
}<br>
int gethelp(int nd){<br>
 int i;<br>
 int len =dat[nd].conn.size();<br>
 for (i=dat[nd].sp;i&lt;len;i++){<br>
&nbsp;&nbsp; int tmp= dat[nd].conn[i];<br>
&nbsp;&nbsp; if (find(dat[nd].nowid)==find(dat[tmp].nowid)){<br>
&nbsp;&nbsp;&nbsp; dat[nd].sp=i+1;<br>
&nbsp;&nbsp;&nbsp; return tmp;<br>
&nbsp;&nbsp; }<br>
 }<br>
 return -1;<br>
}<br>
void mkrel(int nd ,int bad){ <br>
 int id = dat[nd].nowid;<br>
 int i;<br>
 for (i=dat[nd].frst;i&lt;dat[nd].fred;i++){<br>
&nbsp;&nbsp; if (front[i]-&gt;to!=bad){<br>
&nbsp;&nbsp;&nbsp; merge(id , dat[front[i]-&gt;to].nowid);<br>
&nbsp;&nbsp; }<br>
 }<br>
}</p>
<p> </p> <a href="http://hi.baidu.com/yjy2410578/blog/item/d03747443a19ea88b3b7dc47.html">阅读全文</a>
		
		<br/><b>类别：</b><a href="http://hi.baidu.com/yjy2410578/blog/category/Oj">Oj</a>&nbsp;<a href="http://hi.baidu.com/yjy2410578/blog/item/d03747443a19ea88b3b7dc47.html#comment">查看评论</a>]]></description>
        <pubDate>2009-11-16  11:32</pubDate>
        <category><![CDATA[Oj]]></category>
        <author><![CDATA[yjy2410578]]></author>
		<guid>http://hi.baidu.com/yjy2410578/blog/item/d03747443a19ea88b3b7dc47.html</guid>
</item>

<item>
        <title><![CDATA[xqib]]></title>
        <link><![CDATA[http://hi.baidu.com/yjy2410578/blog/item/617dbfee5e08fbf1b3fb953f.html]]></link>
        <description><![CDATA[
		
		<p>&lt;html&gt;<br>
&lt;head&gt;<br>
&lt;script type=&quot;text/xquery&quot;&gt;<br>
declare sequential function local:main(){<br>
 browser:alert(&quot;miao&quot;)<br>
};<br>
&lt;/script&gt;<br>
&lt;/head&gt;<br>
&lt;body&gt;<br>
&lt;h1&gt;miao miao &lt;/h1&gt;<br>
&lt;/body&gt;<br>
&lt;/html&gt;</p>
<p> </p> 
		
		<br/><b>类别：</b><a href="http://hi.baidu.com/yjy2410578/blog/category/Css">Css</a>&nbsp;<a href="http://hi.baidu.com/yjy2410578/blog/item/617dbfee5e08fbf1b3fb953f.html#comment">查看评论</a>]]></description>
        <pubDate>2009-11-14  18:01</pubDate>
        <category><![CDATA[Css]]></category>
        <author><![CDATA[yjy2410578]]></author>
		<guid>http://hi.baidu.com/yjy2410578/blog/item/617dbfee5e08fbf1b3fb953f.html</guid>
</item>

<item>
        <title><![CDATA[二叉树前序+中序 --〉后序]]></title>
        <link><![CDATA[http://hi.baidu.com/yjy2410578/blog/item/674ea023793039589922edd9.html]]></link>
        <description><![CDATA[
		
		<p>#include &lt;stdio.h&gt;<br>
#include &lt;string.h&gt;<br>
const int SIZE=30;<br>
char pre[SIZE];<br>
char mid[SIZE];<br>
char sufix(SIZE);</p>
<p>class Node{<br>
public:<br>
&nbsp;&nbsp; Node * le , *ri;<br>
&nbsp;&nbsp; char val;<br>
&nbsp;&nbsp; Node(char v):val(v),le(NULL),ri(NULL){};<br>
};<br>
Node * work( int lo, int hi);<br>
void show(Node * );<br>
void clear(Node *);<br>
int nd=0;<br>
int main(){<br>
// freopen(&quot;dat.txt&quot;,&quot;r&quot;,stdin);<br>
 while (scanf(&quot;%s%s&quot;,pre,mid)!=EOF){<br>
&nbsp;&nbsp; nd=0;<br>
&nbsp;&nbsp; Node * rt =work(0,strlen(mid));<br>
&nbsp;&nbsp; show(rt);<br>
&nbsp;&nbsp; printf(&quot;\n&quot;);<br>
&nbsp;&nbsp; clear(rt);<br>
 }<br>
 return 0;<br>
}</p>
<p>Node * work(int lo, int hi){<br>
 char * ptr =strchr(mid+lo , pre[nd]);<br>
 if (ptr==NULL)<br>
&nbsp;&nbsp; return NULL;<br>
 int pos = ptr-mid;<br>
 if (pos&gt;=hi)<br>
&nbsp;&nbsp; return NULL;<br>
 Node * rt = new Node(pre[nd]);<br>
 nd++;<br>
 rt-&gt;le = work(lo,pos);<br>
 rt-&gt;ri = work(pos,hi);<br>
 return rt;<br>
}<br>
void show(Node * nd){<br>
 if (nd==NULL)<br>
&nbsp;&nbsp; return ;<br>
 show(nd-&gt;le);<br>
 show(nd-&gt;ri);<br>
 printf(&quot;%c&quot;,nd-&gt;val);<br>
}<br>
void clear(Node * nd){<br>
 if (nd==NULL)<br>
&nbsp;&nbsp; return ;<br>
 if (nd-&gt;le)<br>
&nbsp;&nbsp; clear(nd-&gt;le);<br>
 else if(nd-&gt;ri)<br>
&nbsp;&nbsp; clear(nd-&gt;ri);<br>
 delete nd;<br>
 nd=NULL;<br>
}</p> <a href="http://hi.baidu.com/yjy2410578/blog/item/674ea023793039589922edd9.html">阅读全文</a>
		
		<br/><b>类别：</b><a href="http://hi.baidu.com/yjy2410578/blog/category/Oj">Oj</a>&nbsp;<a href="http://hi.baidu.com/yjy2410578/blog/item/674ea023793039589922edd9.html#comment">查看评论</a>]]></description>
        <pubDate>2009-11-13  09:26</pubDate>
        <category><![CDATA[Oj]]></category>
        <author><![CDATA[yjy2410578]]></author>
		<guid>http://hi.baidu.com/yjy2410578/blog/item/674ea023793039589922edd9.html</guid>
</item>

<item>
        <title><![CDATA[antlr learn]]></title>
        <link><![CDATA[http://hi.baidu.com/yjy2410578/blog/item/4d91e40827f1aedb62d9869f.html]]></link>
        <description><![CDATA[
		
		<p>//T.g</p>
<p>//start</p>
<p>grammar T;<br>
r: 'call' ID ';'{System.out.printf(&quot;invoke &quot;+$ID.text);};<br>
ID: 'a'..'z'+;<br>
WS: (' '|'\n'|'\r')+ {$channel=HIDDEN;} ;</p>
<p>//end</p>
<p>//start Test.java</p>
<p>import org.antlr.runtime.*;<br>
public class Test{<br>
 public static void main(String atgs[]) throws Exception{<br>
&nbsp;&nbsp; ANTLRInputStream  input = new ANTLRInputStream(System.in);<br>
&nbsp;&nbsp; TLexer lexer = new TLexer(input);<br>
&nbsp;&nbsp; CommonTokenStream tokens = new CommonTokenStream(lexer);<br>
&nbsp;&nbsp; TParser parser = new TParser(tokens);<br>
&nbsp;&nbsp; parser.r();<br>
 }<br>
}</p>
<p>//end</p> <a href="http://hi.baidu.com/yjy2410578/blog/item/4d91e40827f1aedb62d9869f.html">阅读全文</a>
		
		<br/><b>类别：</b><a href="http://hi.baidu.com/yjy2410578/blog/category/Antlr">Antlr</a>&nbsp;<a href="http://hi.baidu.com/yjy2410578/blog/item/4d91e40827f1aedb62d9869f.html#comment">查看评论</a>]]></description>
        <pubDate>2009-11-11  09:35</pubDate>
        <category><![CDATA[Antlr]]></category>
        <author><![CDATA[yjy2410578]]></author>
		<guid>http://hi.baidu.com/yjy2410578/blog/item/4d91e40827f1aedb62d9869f.html</guid>
</item>

<item>
        <title><![CDATA[usaco cookie]]></title>
        <link><![CDATA[http://hi.baidu.com/yjy2410578/blog/item/2ac8a94a5703e62908f7eff9.html]]></link>
        <description><![CDATA[
		
		<span class="Apple-style-span" style="word-spacing: 0px; font: medium Simsun; text-transform: none; color: rgb(0,0,0); text-indent: 0px; white-space: normal; letter-spacing: normal; border-collapse: separate; orphans: 2; widows: 2; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px">
<pre style="word-wrap: break-word">/*
LANG: C++
ID: yjyfrom1
PROG: cookie
*/

#include &lt;stdio.h&gt;
#include &lt;string.h&gt;
#include &lt;math.h&gt;
#include &lt;iostream&gt;
#include &lt;vector&gt;
#include &lt;algorithm&gt;
using namespace std;
/*
maxnode 点的个数
maxedge 边的个数
oo INF
*/
const int maxnode = 2000 + 5;
const int maxedge = 400000 + 5;
const int oo = 1000000000;

int node, src, dest, nedge;
int head[maxnode], point[maxedge], next[maxedge], flow[maxedge], capa[maxedge];
int dist[maxnode], Q[maxnode], work[maxnode];

/*
node 顶点数[0 ,node)

*/
void init(int _node, int _src, int _dest) {
 node = _node;
 src = _src;
 dest = _dest;
 for (int i = 0; i &lt; node; i++) head[i] = -1;
 nedge = 0;
}

/*
添加容量c1 正向，c2 反向
一般的有向图c1 =cap , c2=0
无向图c1=c2=cap;
*/
void addedge(int u, int v, int c1, int c2) {
 point[nedge] = v, capa[nedge] = c1, flow[nedge] = 0, next[nedge] = head[u], head[u] = (nedge++);
 point[nedge] = u, capa[nedge] = c2, flow[nedge] = 0, next[nedge] = head[v], head[v] = (nedge++);
}

/*
找层次图，最后一次的dist[i]&lt;0 的连dest , dist[i]&gt;0 连src , 之间的边是割边
*/
bool dinic_bfs() {
 memset(dist, -1, sizeof (dist));
 dist[src] = 0;
 int sizeQ = 0;
 Q[sizeQ++] = src;
 for (int cl = 0; cl &lt; sizeQ; cl++)
  for (int k = Q[cl], i = head[k]; i &gt;= 0; i = next[i])
   if (flow[i] &lt; capa[i] &amp;&amp; dist[point[i]] &lt; 0) {
    dist[point[i]] = dist[k] + 1;
    Q[sizeQ++] = point[i];
   }
   return dist[dest] &gt;= 0;
}

int dinic_dfs(int x, int exp) {
 if (x == dest) return exp;
 for (int &amp;i = work[x]; i &gt;= 0; i = next[i]) {
  int v = point[i], tmp;
  if (flow[i] &lt; capa[i] &amp;&amp; dist[v] == dist[x] + 1 &amp;&amp; (tmp = dinic_dfs(v, min(exp, capa[i] - flow[i]))) &gt; 0) {
   flow[i] += tmp;
   flow[i^1] -= tmp;
   return tmp;
  }
 }
 return 0;
}
/*
最大流
*/
int dinic_flow() {
 int result = 0;
 while (dinic_bfs()) {
  for (int i = 0; i &lt; node; i++) work[i] = head[i];
  while (1) {
   int delta = dinic_dfs(src, oo);
   if (delta == 0) break;
   result += delta;
  }
 }
 return result;
}

const int SIZE = 1010;
const int LEN = 200;
class Cow{
public:
 int will;
 vector&lt;int&gt; gp;
 void show(){
  printf(&quot;will: %d\n&quot;,will);
  printf(&quot;gp: %d\n&quot;,gp.size());
  int i;
  int len = gp.size();
  for (i=0;i&lt;len;i++){
   printf(&quot; %d &quot;,gp[i]);
  }
  printf(&quot;\n&quot;);
 }
};
Cow cow[SIZE];
double tmpcnt[SIZE];
void myinit();
int nbcow , gpsz;
void show();
bool mywork();
int mat[LEN];
int main(){
 freopen(&quot;cookie.in&quot;,&quot;r&quot;,stdin);
 freopen(&quot;cookie.out&quot;,&quot;w&quot;,stdout);
 myinit();
 //show();
 if (mywork()){
  int i;
  for (i=1;i&lt;=gpsz;i++){
   printf(&quot;%d\n&quot;,mat[i]);
  }
 }else{
  printf(&quot;-1\n&quot;);
 }
 return 0;
}

bool mywork(){
 int src=0 ;
 //cow [1 , nbcow ]
 //group [1 , gpsz] --&gt; [nbcow+i] i= 1..gpsz
 int dest = nbcow+gpsz+1;
 int tot = dest+1;
 init(tot,src,dest);
 int i,j;
 for (i=1;i&lt;=nbcow;i++)
  addedge(src,i,cow[i].will,0);
 for (i=1;i&lt;=gpsz;i++)
  addedge(i+nbcow , dest , 1,0);
 for (i=1;i&lt;=nbcow;i++){
  int len = cow[i].gp.size();
  for (j=0;j&lt;len;j++){
   int nx = cow[i].gp[j] +nbcow;
   addedge(i,nx,1,0);
  }
 }
 int myflow=dinic_flow();
 //printf(&quot;maxflow:%d \n&quot;,myflow);
 if (myflow!=gpsz)
  return false;
 int nd;
 memset(mat,-1,sizeof(mat));
 for (nd=1;nd&lt;=nbcow;nd++){
  for (i=head[nd] ; i&gt;=0 ; i=next[i]){
   if (flow[i]==1 &amp;&amp; flow[i]==capa[i]){
    int to =point[i]-nbcow;
    if (to&gt;=1 &amp;&amp; to&lt;=gpsz){
     //printf(&quot;(%d ,%d )\n&quot;,nd,to);
     mat[to]=nd;
    }
   }
  }
 }

 return true;
}

void myinit(){
 scanf(&quot;%d%d&quot;,&amp;nbcow,&amp;gpsz);
 int i,j;
 for (i=1;i&lt;=nbcow;i++){
  cow[i].will=0;
  cow[i].gp.clear();
  tmpcnt[i]=0;
 }
 for (i=1;i&lt;=gpsz;i++){
  int sz;
  scanf(&quot;%d&quot;,&amp;sz);
  for (j=0;j&lt;sz;j++){
   int nd;
   scanf(&quot;%d&quot;,&amp;nd);
   cow[nd].gp.push_back(i);
   tmpcnt[nd]+=1.0/(double)sz;
  }
 }
 for (i=1;i&lt;=nbcow;i++){
  cow[i].will = (int)ceil(tmpcnt[i]);
 }
}
void show(){
 int i;
 for (i=1;i&lt;=nbcow;i++){
  cow[i].show();
 }
}</pre>
</span> <a href="http://hi.baidu.com/yjy2410578/blog/item/2ac8a94a5703e62908f7eff9.html">阅读全文</a>
		
		<br/><b>类别：</b><a href="http://hi.baidu.com/yjy2410578/blog/category/Usaco">Usaco</a>&nbsp;<a href="http://hi.baidu.com/yjy2410578/blog/item/2ac8a94a5703e62908f7eff9.html#comment">查看评论</a>]]></description>
        <pubDate>2009-11-09  23:45</pubDate>
        <category><![CDATA[Usaco]]></category>
        <author><![CDATA[yjy2410578]]></author>
		<guid>http://hi.baidu.com/yjy2410578/blog/item/2ac8a94a5703e62908f7eff9.html</guid>
</item>

<item>
        <title><![CDATA[ipconfig]]></title>
        <link><![CDATA[http://hi.baidu.com/yjy2410578/blog/item/5c3f4b6efe15c0d080cb4aa2.html]]></link>
        <description><![CDATA[
		
		<p> </p>
<p>Windows IP Configuration</p>
<p> </p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;  Host Name . . . . . . . . . . . . : YJYHOME</p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;  Primary Dns Suffix  . . . . . . . :</p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;  Node Type . . . . . . . . . . . . : Unknown</p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;  IP Routing Enabled. . . . . . . . : No</p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;  WINS Proxy Enabled. . . . . . . . : No</p>
<p> </p>
<p>Ethernet adapter 本地连接:</p>
<p> </p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;  Connection-specific DNS Suffix  . :</p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;  Description . . . . . . . . . . . : NVIDIA nForce Networking Controller</p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;  Physical Address. . . . . . . . . : 00-1D-60-83-F2-7A</p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;  Dhcp Enabled. . . . . . . . . . . : Yes</p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;  Autoconfiguration Enabled . . . . : Yes</p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;  IP Address. . . . . . . . . . . . : 192.168.1.104</p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;  Subnet Mask . . . . . . . . . . . : 255.255.255.0</p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;  IP Address. . . . . . . . . . . . : fe80::21d:60ff:fe83:f27a%4</p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;  Default Gateway . . . . . . . . . : 192.168.1.1</p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;  DHCP Server . . . . . . . . . . . : 192.168.1.1</p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;  DNS Servers . . . . . . . . . . . : 202.112.80.106</p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;  fec0:0:0:ffff::1%1</p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;  fec0:0:0:ffff::2%1</p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;  fec0:0:0:ffff::3%1</p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;  Lease Obtained. . . . . . . . . . : 2009年11月4日 22:37:34</p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;  Lease Expires . . . . . . . . . . : 2009年11月5日 0:37:34</p>
<p> </p>
<p>Tunnel adapter Teredo Tunneling Pseudo-Interface:</p>
<p> </p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;  Connection-specific DNS Suffix  . :</p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;  Description . . . . . . . . . . . : Teredo Tunneling Pseudo-Interface</p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;  Physical Address. . . . . . . . . : FF-FF-FF-FF-FF-FF-FF-FF</p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;  Dhcp Enabled. . . . . . . . . . . : No</p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;  IP Address. . . . . . . . . . . . : fe80::ffff:ffff:fffd%5</p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;  Default Gateway . . . . . . . . . :</p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;  NetBIOS over Tcpip. . . . . . . . : Disabled</p>
<p> </p>
<p>Tunnel adapter Automatic Tunneling Pseudo-Interface:</p>
<p> </p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;  Connection-specific DNS Suffix  . :</p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;  Description . . . . . . . . . . . : Automatic Tunneling Pseudo-Interface</p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;  Physical Address. . . . . . . . . : C0-A8-01-68</p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;  Dhcp Enabled. . . . . . . . . . . : No</p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;  IP Address. . . . . . . . . . . . : fe80::5efe:192.168.1.104%2</p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;  Default Gateway . . . . . . . . . : 2001:da8:207:1:0:5efe:202.112.95.129</p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;  DNS Servers . . . . . . . . . . . : fec0:0:0:ffff::1%1</p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;  fec0:0:0:ffff::2%1</p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;  fec0:0:0:ffff::3%1</p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;  NetBIOS over Tcpip. . . . . . . . : Disabled</p>
<p> </p> <a href="http://hi.baidu.com/yjy2410578/blog/item/5c3f4b6efe15c0d080cb4aa2.html">阅读全文</a>
		
		<br/><b>类别：</b><a href="http://hi.baidu.com/yjy2410578/blog/category/net%20%D0%AD%D2%E9">net 协议</a>&nbsp;<a href="http://hi.baidu.com/yjy2410578/blog/item/5c3f4b6efe15c0d080cb4aa2.html#comment">查看评论</a>]]></description>
        <pubDate>2009-11-04  23:12</pubDate>
        <category><![CDATA[net 协议]]></category>
        <author><![CDATA[yjy2410578]]></author>
		<guid>http://hi.baidu.com/yjy2410578/blog/item/5c3f4b6efe15c0d080cb4aa2.html</guid>
</item>

<item>
        <title><![CDATA[c 学习好网站]]></title>
        <link><![CDATA[http://hi.baidu.com/yjy2410578/blog/item/57d2b5434b2c221b9213c6b0.html]]></link>
        <description><![CDATA[
		
		<p><a href="http://learn.akae.cn/media/index.html">http://learn.akae.cn/media/index.html</a></p>
<p> </p> 
		
		<br/><b>类别：</b><a href="http://hi.baidu.com/yjy2410578/blog/category/c%26%2347%3Bc%2B%2B">c&#47;c++</a>&nbsp;<a href="http://hi.baidu.com/yjy2410578/blog/item/57d2b5434b2c221b9213c6b0.html#comment">查看评论</a>]]></description>
        <pubDate>2009-11-04  17:12</pubDate>
        <category><![CDATA[c&#47;c++]]></category>
        <author><![CDATA[yjy2410578]]></author>
		<guid>http://hi.baidu.com/yjy2410578/blog/item/57d2b5434b2c221b9213c6b0.html</guid>
</item>


</channel>
</rss>