锘??xml version="1.0" encoding="utf-8" standalone="yes"?>久久亚洲日韩看片无码,久久精品中文无码资源站 ,91麻精品国产91久久久久http://www.shnenglu.com/patriking/category/15843.htmlzh-cnSun, 23 Jan 2011 04:20:58 GMTSun, 23 Jan 2011 04:20:58 GMT60STL 瀹瑰櫒Dequehttp://www.shnenglu.com/patriking/archive/2011/01/21/139060.htmlpatrikingpatrikingFri, 21 Jan 2011 14:25:00 GMThttp://www.shnenglu.com/patriking/archive/2011/01/21/139060.htmlhttp://www.shnenglu.com/patriking/comments/139060.htmlhttp://www.shnenglu.com/patriking/archive/2011/01/21/139060.html#Feedback0http://www.shnenglu.com/patriking/comments/commentRss/139060.htmlhttp://www.shnenglu.com/patriking/services/trackbacks/139060.htmltemplate <class T, template <class U> class Allocator = allocator>
class deque {
public:
// typedefs:
    typedef iterator;
    typedef const_iterator;
    typedef Allocator
<T>::pointer pointer;
    typedef Allocator
<T>::reference reference;
    typedef Allocator
<T>::const_reference const_reference;
    typedef size_type;
    typedef difference_type;
    typedef T value_type;
    typedef reverse_iterator;
    typedef const_reverse_iterator;
// allocation/deallocation:
    deque();
    deque(size_type n, 
const T& value = T());
    deque(
const deque<T, Allocator>& x);
    template 
<class InputIterator>
    deque(InputIterator first, InputIterator last);
    
~deque();
    deque
<T, Allocator>& operator=(const deque<T, Allocator>& x);
    
void swap(deque<T, Allocator>& x);
// accessors:
    iterator begin();
    const_iterator begin() 
const;
    iterator end();
    const_iterator end() 
const;
    reverse_iterator rbegin();
    const_reverse_iterator rbegin();
    reverse_iterator rend();
    const_reverse_iterator rend();
    size_type size() 
const;
    size_type max_size() 
const;
    
bool empty() const;
    reference 
operator[](size_type n);
    const_reference 
operator[](size_type n) const;
    reference front();
    const_reference front() 
const;
    reference back();
    const_reference back() 
const;
// insert/erase:
    void push_front(const T& x);
    
void push_back(const T& x);
    iterator insert(iterator position, 
const T& x = T());
    
void insert (iterator position, size_type n, const T& x);
    template 
<class InputIterator>
    
void insert (iterator position, InputIterator first, InputIterator last);
    
void pop_front();
    
void pop_back();
    
void erase(iterator position);
    
void erase(iterator first, iterator last);
};




patriking 2011-01-21 22:25 鍙戣〃璇勮
]]>
STL 瀹瑰櫒Listhttp://www.shnenglu.com/patriking/archive/2011/01/21/139059.htmlpatrikingpatrikingFri, 21 Jan 2011 14:15:00 GMThttp://www.shnenglu.com/patriking/archive/2011/01/21/139059.htmlhttp://www.shnenglu.com/patriking/comments/139059.htmlhttp://www.shnenglu.com/patriking/archive/2011/01/21/139059.html#Feedback0http://www.shnenglu.com/patriking/comments/commentRss/139059.htmlhttp://www.shnenglu.com/patriking/services/trackbacks/139059.htmltemplate <class T, template <class U>
class Allocator = allocator> class list 
{
public:
// typedefs:
    typedef iterator
    typedef const_iterator
    typedef Allocator
<T>::pointer pointer
    typedef Allocator
<T>::reference reference
    typedef Allocator
<T>::const_reference const_reference
    typedef size_type
    typedef difference_type
    typedef T value_type
    typedef reverse_iterator
    typedef const_reverse_iterator;
// allocation/deallocation:
    list()
    list(size_type n, 
const T& value = T())
    template 
<class InputIterator>
    list(InputIterator first, InputIterator last)
    list(
const list<T, Allocator>& x)
    
~list()
    list
<T, Allocator>& operator=(const list<T, Allocator>& x)
    
void swap(list<T, Allocator>& x);
// accessors:
    iterator begin()
    const_iterator begin() 
const
    iterator end()
    const_iterator end() 
const
    reverse_iterator rbegin()
    const_reverse_iterator rbegin();
    reverse_iterator rend();
    const_reverse_iterator rend();
    
bool empty() const;
    size_type size() 
const;
    size_type max_size() 
const;
    reference front();
    const_reference front() 
const;
    reference back();
    const_reference back() 
const;
// insert/erase:
    void push_front(const T& x);
    
void push_back(const T& x);
    iterator insert(iterator position, 
const T& x = T());
    
void insert(iterator position, size_type n, const T& x);
    template 
<class InputIterator>
    
void insert(iterator position, InputIterator first, InputIterator last);
    
void pop_front();
    
void pop_back();
    
void erase(iterator position);
    
void erase(iterator first, iterator last);
// special mutative operations on list:
    void splice(iterator position, list<T, Allocator>& x);
    
void splice(iterator position, list<T, Allocator>& x, iterator i);
    
void splice(iterator position, list<T, Allocator>& x,
    iterator first, iterator last);
    
void remove(const T& value);
    template 
<class Predicate> void remove_if(Predicate pred);
    
void unique();
    template 
<class BinaryPredicate> void unique(BinaryPredicate binary_pr
    
void merge(list<T, Allocator>& x);
    template 
<class Compare> void merge(list<T, Allocator>& x, Compare com
    
void reverse();
    
void sort();
    template 
<class Compare> void sort(Compare comp);
};



patriking 2011-01-21 22:15 鍙戣〃璇勮
]]>
鏈灝忓壊 ZOJ@2788http://www.shnenglu.com/patriking/archive/2011/01/20/138966.htmlpatrikingpatrikingThu, 20 Jan 2011 07:52:00 GMThttp://www.shnenglu.com/patriking/archive/2011/01/20/138966.htmlhttp://www.shnenglu.com/patriking/comments/138966.htmlhttp://www.shnenglu.com/patriking/archive/2011/01/20/138966.html#Feedback0http://www.shnenglu.com/patriking/comments/commentRss/138966.htmlhttp://www.shnenglu.com/patriking/services/trackbacks/138966.html浠庣洿瑙備笂鐪嬶紝鎴泦(S,T)鏄粠婧愮偣s鍒版眹鐐箃鐨勫繀緇忎箣璺紝濡傛灉璇ヨ礬鍫靛鍒欐祦浠巗鏃犳硶鍒拌揪t銆備簬鏄垜浠彲浠ュ緱鍒?span style="color: red;">鏈澶ф祦鏈灝忓壊瀹氱悊錛氫換鎰忎竴涓祦緗戠粶鐨勬渶澶ф祦閲忕瓑浜庤緗戠粶鐨勬渶灝忕殑鍓茬殑瀹歸噺銆?br>    鏈灝忓壊闂錛?a >ZOJ@2788
    棰樻剰錛氬湪涓鏍嬫ゼ涓湁鑻ュ共鎴塊棿錛屼竴涓埧闂存湁鑻ュ共鎵囬棬閫氬線鍒殑鎴塊棿錛岀幇鍦ㄦ埧闂翠腑鏈変竴涓猻ecure room銆傜敱浜庢湁涓浜涙晫浜哄凡緇忔綔鍏ユ煇涓浜涙埧闂達紝鐜板湪闂叧闂渶灝戠殑涓浜涢棬錛屼嬌寰楁晫浜轟滑鍒拌揪涓嶄簡secure room銆傚浜庝竴鎵囬棬榪為欰-B錛岃嫢鎺у埗闈㈡澘CP鍦ˋ鏂癸紝鍒欐繪槸鍙互浠嶢->B錛屼絾鏄嫢鍏充笂闂紝鍒橞涓嶈兘鍒拌揪A銆?br>    瑙f硶錛氭渶澶ф祦銆傞鍏堥氳繃floyd綆楁硶鍒ゆ柇鏄惁鏁屼漢鎬繪槸鍙互鍒拌揪secure room錛屽鏋滆兘鐩存帴杈撳嚭緇撴灉錛涘鏋滀笉鑳斤紝鍒欓氳繃鏈澶ф祦綆楁硶姹傝В鍗沖彲銆傚浜庝竴鎵囬棬A-B錛孋P鍦ˋ鏂瑰垯浠嶢榪炰竴鏉℃湁鍚戣竟鍒癇錛屽閲忎負鏃犵┓澶э紝浠嶣榪炰竴鏉¤竟鍒癆錛屽閲忎負1銆備袱涓埧闂翠箣闂村彲鑳芥湁澶氭墖闂紝杈圭殑瀹歸噺绱姞鍗沖彲銆傚鍔犱竴涓簮鐐癸紝浠庢簮鐐硅繛杈瑰埌鏈夋晫浜虹殑鎴塊棿錛屽閲忎負1銆傚鍥炬眰鏈澶ф祦鍗充負緇撴灉銆?br>浠g爜濡備笅錛?br>
// 2389732      2011-01-20 15:06:16        Accepted      2788      C++      0      184      *******
#include<cstdio>
#include
<algorithm>
#include
<cstring>
#define MAXN 22
#define inf 1000000
int map[MAXN][MAXN];
int flow[MAXN][MAXN];
int max_flow(int n,int mat[][MAXN],int source,int sink,int flow[][MAXN]){ 
    
int pre[MAXN],que[MAXN],p,q,t,i,j;
    
int d[MAXN];
    
int tmp;
    
if (source==sink) return inf; 
    
for (i=0;i<n;i++
        
for    (j=0;j<n;flow[i][j++]=0); 
    
for (;;){ 
        
for (i=0;i<n;pre[i++]=0); 
        pre[t
=source]=source+1,d[t]=inf; 
        
for (p=q=0;p<=q&&!pre[sink];t=que[p++]) 
               
for (i=0;i<n;i++
                
if (!pre[i]&&(tmp=mat[t][i]-flow[t][i])) 
                     pre[que[q
++]=i]=t+1,d[i]=d[t]<tmp?d[t]:tmp; 
                
else if (!pre[i]&&(tmp=flow[i][t])) 
                 pre[que[q
++]=i]=-t-1,d[i]=d[t]<tmp?d[t]:tmp; 
        
if (!pre[sink]) break
        
for (i=sink;i!=source;) 
               
if (pre[i]>0
                flow[pre[i]
-1][i]+=d[sink],i=pre[i]-1
               
else 
                flow[i][
-pre[i]-1]-=d[sink],i=-pre[i]-1
    } 
    tmp 
= 0;
    
for (i=0;i<n;tmp+=flow[source][i++]); 
    
return tmp; 
}
int main()
{
    
int T, n, m, k, y;
    
char str[3];
    
int d[MAXN];
    scanf(
"%d",&T);
    
while(T--)
    {
        scanf(
"%d%d",&m,&n);
        n
++;
        memset(map,
0,sizeof(map));
        memset(flow,
0,sizeof(flow));
        
for(int i = 1; i <= m; i++){
            scanf(
"%s %d",str, &k);
            d[i] 
= (strlen(str) == 1);
            
if(d[i])map[0][i] = inf;
            
for(int j = 0; j < k; j++){
                scanf(
"%d",&y);
                y
++;
                flow[i][y] 
= 1;
                map[i][y] 
+= inf;
                map[y][i] 
+= 1;
            }
        }
        
// Checking always exists a path to secure room. Output "PANIC ROOM BREACH"!
        for(k = 1; k <= m; k++)  
            
for(int i = 1; i <= m; i++)
                
for(int j = 1; j <= m; j++)
                    
if(flow[i][k]&&flow[k][j])
                        flow[i][j] 
= 1;
        
for(k = 1; k <= m && !(d[k] && flow[k][n]); k++);
        
if(k <= m)
            printf(
"PANIC ROOM BREACH\n");
        
else
            printf(
"%d\n", max_flow(m+1,map,0,n,flow));
    }
    
return 0;
}




patriking 2011-01-20 15:52 鍙戣〃璇勮
]]>
C璇█涓璵ath.h搴撲腑鐨勫父鐢ㄥ嚱鏁?/title><link>http://www.shnenglu.com/patriking/archive/2011/01/19/138914.html</link><dc:creator>patriking</dc:creator><author>patriking</author><pubDate>Wed, 19 Jan 2011 11:57:00 GMT</pubDate><guid>http://www.shnenglu.com/patriking/archive/2011/01/19/138914.html</guid><wfw:comment>http://www.shnenglu.com/patriking/comments/138914.html</wfw:comment><comments>http://www.shnenglu.com/patriking/archive/2011/01/19/138914.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.shnenglu.com/patriking/comments/commentRss/138914.html</wfw:commentRss><trackback:ping>http://www.shnenglu.com/patriking/services/trackbacks/138914.html</trackback:ping><description><![CDATA[int abs(int i) 榪斿洖鏁村瀷鍙傛暟i鐨勭粷瀵瑰?br>double cabs(struct complex znum) 榪斿洖澶嶆暟znum鐨勭粷瀵瑰?br>double fabs(double x) 榪斿洖鍙岀簿搴﹀弬鏁皒鐨勭粷瀵瑰?br>long labs(long n) 榪斿洖闀挎暣鍨嬪弬鏁皀鐨勭粷瀵瑰?br>double exp(double x) 榪斿洖鎸囨暟鍑芥暟e^x鐨勫?br>double frexp(double value,int *eptr) 榪斿洖value=x*2^n涓瓁鐨勫?0.5<=x<1),n瀛樿串鍦╡ptr涓?br>double ldexp(double value,int exp); 榪斿洖value*2^exp鐨勫?br>double log(double X) 榪斿洖logeX鐨勫?浠涓哄簳鐨勫鏁?<br>double log10(double x) 榪斿洖log10x鐨勫?浠?0涓哄簳鐨勫鏁?br>double pow(double x,double y) 榪斿洖x^y鐨勫?br>double pow10(int p) 榪斿洖10^p鐨勫?br>double sqrt(double x) 榪斿洖a,涓攁婊¤凍a*a=x,a>=0<br>double acos(double x) 榪斿洖x鐨勫弽浣欏雞cos^-1(x)鍊?x涓哄姬搴?br>double asin(double x) 榪斿洖x鐨勫弽姝e雞sin^-1(x)鍊?x涓哄姬搴?br>double atan(double x) 榪斿洖x鐨勫弽姝e垏tan^-1(x)鍊?x涓哄姬搴?br>double atan2(double y,double x) 榪斿洖y/x鐨勫弽姝e垏tan^-1(x)鍊?y鐨剎涓哄姬搴?br>double cos(double x) 榪斿洖x鐨勪綑寮os(x)鍊?x涓哄姬搴?br>double sin(double x) 榪斿洖x鐨勬寮in(x)鍊?x涓哄姬搴?br>double tan(double x) 榪斿洖x鐨勬鍒噒an(x)鍊?x涓哄姬搴?br>double cosh(double x) 榪斿洖x鐨勫弻鏇蹭綑寮osh(x)鍊?x涓哄姬搴?br>double sinh(double x) 榪斿洖x鐨勫弻鏇叉寮inh(x)鍊?x涓哄姬搴?br>double tanh(double x) 榪斿洖x鐨勫弻鏇叉鍒噒anh(x)鍊?x涓哄姬搴?br>double hypot(double x,double y) 榪斿洖鐩磋涓夎褰㈡枩杈圭殑闀垮害(z),x鍜寉涓虹洿瑙掕竟鐨勯暱搴?z^2=x^2+y^2<br>double ceil(double x) 榪斿洖涓嶅皬浜巟鐨勬渶灝忔暣鏁?br>double floor(double x) 榪斿洖涓嶅ぇ浜巟鐨勬渶澶ф暣鏁?br>void srand(unsigned seed) 鍒濆鍖栭殢鏈烘暟鍙戠敓鍣?br>int rand() 浜х敓涓涓殢鏈烘暟騫惰繑鍥炶繖涓暟<br>double poly(double x,int n,double c[])浠庡弬鏁頒駭鐢熶竴涓欏瑰紡<br>double modf(double value,double *iptr)灝嗗弻綺懼害鏁皏alue鍒嗚В鎴愭暣鏁伴儴鍒嗗拰灝忔暟閮ㄥ垎錛宨ptr涓烘暣鏁伴儴鍒嗭紝榪斿洖灝忔暟閮ㄥ垎<br>double fmod(double x,double y) 榪斿洖x/y鐨勪綑鏁?br>double atof(char *nptr) 灝嗗瓧絎︿覆nptr杞崲鎴愭誕鐐規暟騫惰繑鍥炶繖涓誕鐐規暟<br>double atoi(char *nptr) 灝嗗瓧絎︿覆nptr杞崲鎴愭暣鏁板茍榪斿洖榪欎釜鏁存暟<br>double atol(char *nptr) 灝嗗瓧絎︿覆nptr杞崲鎴愰暱鏁存暟騫惰繑鍥炶繖涓暣鏁?br>char *ecvt(double value,int ndigit,int *decpt,int *sign)灝嗘誕鐐規暟value杞崲鎴愬瓧絎︿覆騫惰繑鍥炶瀛楃涓?br>char *fcvt(double value,int ndigit,int *decpt,int *sign)灝嗘誕鐐規暟value杞崲鎴愬瓧絎︿覆騫惰繑鍥炶瀛楃涓?br>char *gcvt(double value,int ndigit,char *buf)灝嗘暟value杞崲鎴愬瓧絎︿覆騫跺瓨浜巄uf涓?騫惰繑鍥瀊uf鐨勬寚閽?br>char *ultoa(unsigned long value,char *string,int radix)灝嗘棤絎﹀彿鏁村瀷鏁皏alue杞崲鎴愬瓧絎︿覆騫惰繑鍥炶瀛楃涓?radix涓鴻漿鎹㈡椂鎵鐢ㄥ熀鏁?br>char *ltoa(long value,char *string,int radix)灝嗛暱鏁村瀷鏁皏alue杞崲鎴愬瓧絎︿覆騫惰繑鍥炶瀛楃涓?radix涓鴻漿鎹㈡椂鎵鐢ㄥ熀鏁?br>char *itoa(int value,char *string,int radix)灝嗘暣鏁皏alue杞崲鎴愬瓧絎︿覆瀛樺叆string,radix涓鴻漿鎹㈡椂鎵鐢ㄥ熀鏁?br>double atof(char *nptr) 灝嗗瓧絎︿覆nptr杞崲鎴愬弻綺懼害鏁?騫惰繑鍥炶繖涓暟,閿欒榪斿洖0<br>int atoi(char *nptr) 灝嗗瓧絎︿覆nptr杞崲鎴愭暣鍨嬫暟, 騫惰繑鍥炶繖涓暟,閿欒榪斿洖0<br>long atol(char *nptr) 灝嗗瓧絎︿覆nptr杞崲鎴愰暱鏁村瀷鏁?騫惰繑鍥炶繖涓暟,閿欒榪斿洖0<br>double strtod(char *str,char **endptr)灝嗗瓧絎︿覆str杞崲鎴愬弻綺懼害鏁?騫惰繑鍥炶繖涓暟,<br>long strtol(char *str,char **endptr,int base)灝嗗瓧絎︿覆str杞崲鎴愰暱鏁村瀷鏁?騫惰繑鍥炶繖涓暟,<br>int matherr(struct exception *e)鐢ㄦ埛淇敼鏁板閿欒榪斿洖淇℃伅鍑芥暟<br>double _matherr(_mexcep why,char *fun,double *arg1p,<br>double *arg2p,double retval)鐢ㄦ埛淇敼鏁板閿欒榪斿洖淇℃伅鍑芥暟<br>unsigned int _clear87() 娓呴櫎嫻偣鐘舵佸瓧騫惰繑鍥炲師鏉ョ殑嫻偣鐘舵?br>void _fpreset()閲嶆柊鍒濅嬌鍖栨誕鐐規暟瀛︾▼搴忓寘<br>unsigned int _status87() 榪斿洖嫻偣鐘舵佸瓧 <br> <img src ="http://www.shnenglu.com/patriking/aggbug/138914.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.shnenglu.com/patriking/" target="_blank">patriking</a> 2011-01-19 19:57 <a href="http://www.shnenglu.com/patriking/archive/2011/01/19/138914.html#Feedback" target="_blank" style="text-decoration:none;">鍙戣〃璇勮</a></div>]]></description></item><item><title>STL涔婼et operation on sorted structureshttp://www.shnenglu.com/patriking/archive/2011/01/18/138722.htmlpatrikingpatrikingTue, 18 Jan 2011 02:17:00 GMThttp://www.shnenglu.com/patriking/archive/2011/01/18/138722.htmlhttp://www.shnenglu.com/patriking/comments/138722.htmlhttp://www.shnenglu.com/patriking/archive/2011/01/18/138722.html#Feedback0http://www.shnenglu.com/patriking/comments/commentRss/138722.htmlhttp://www.shnenglu.com/patriking/services/trackbacks/138722.html鍖呭惈錛氬鏋淸first2,last2)鍖呭惈鍦╗first1,last1)涓紝榪斿洖true,鍚﹀垯榪斿洖false銆?br>bool includes(InputIterator1 first1, InputIterator1 last1,InputIterator2 first2, InputIterator2 last2)
bool includes(InputIterator1 first1, InputIterator1 last1,InputIterator2 first2, InputIterator2 last2, Compare comp)

鍚堝茍錛氬悎騫禰first1,last1)涓嶽first2,last2)涓や釜闆嗗悎銆?br>OutputIterator set_union(InputIterator1 first1, InputIterator1 last1, InputIterator2 first2, InputIterator2 last2, OutputIterator result)
OutputIterator set_union(InputIterator1 first1, InputIterator1 last1, InputIterator2 first2, InputIterator2 last2, OutputIterator result, Compare comp)

姹備氦闆嗭細姹俒first1,last1)涓嶽first2,last2)涓や釜闆嗗悎鐨勪氦闆嗐?
OutputIterator set_intersection(InputIterator1 first1, InputIterator1 last1, InputIterator2 first2, InputIterator2 last2, OutputIterator result)
OutputIterator set_intersection(InputIterator1 first1, InputIterator1 last1, InputIterator2 first2, InputIterator2 last2, OutputIterator result, Compare comp)

姹傚樊錛氭眰鍦╗first1,last1)涓紝鑰屼笉鍦╗first2,last2)鐨勫厓绱犻泦鍚堛?
OutputIterator set_difference(InputIterator1 first1, InputIterator1 last1, InputIterator2 first2, InputIterator2 last2, OutputIterator result)
OutputIterator set_difference(InputIterator1 first1, InputIterator1 last1, InputIterator2 first2, InputIterator2 last2, OutputIterator result, Compare comp)

姹傚縐板樊錛氫袱涓泦鍚堜箣鍜岄泦 鍑忓幓 涓や釜闆嗗悎涔嬩氦闆嗐?
OutputIterator set_symmetric difference(InputIterator1 first1, InputIterator1 last1, InputIterator2 first2, InputIterator2 last2, OutputIterator result)
OutputIterator set_symmetric difference(InputIterator1 first1, InputIterator1 last1, InputIterator2 first2, InputIterator2 last2, OutputIterator result, Compare comp)

#include<iostream>
#include
<algorithm>
#include
<vector>
#include
<iterator>
using namespace std;
void init(vector<int>& v, int a, int b)
{
    v.clear();
    
for(int i = a; i <= b; i++){
        v.push_back(i);
    }
}
int main()
{
    vector
<int>v1, v2;
    vector
<int>::iterator itr;
    cout 
<< "Includes operator:" << endl;
    init(v1,
1,5);
    init(v2,
1,8);
    cout 
<< "Vector v1: ";
    copy(v1.begin(),v1.end(),ostream_iterator
<int>(cout," "));
    cout 
<< endl;
    cout 
<< "Vector v2: ";
    copy(v2.begin(),v2.end(),ostream_iterator
<int>(cout," "));
    cout 
<< endl;
    cout 
<< "v2 is in v1 ? " << (includes(v1.begin(),v1.end(),v2.begin(),v2.end()) ? "yes" : "no"<< endl;
    cout 
<< "v1 is in v2 ? " << (includes(v2.begin(),v2.end(),v1.begin(),v1.end()) ? "yes" : "no"<< endl;
    
    cout 
<< endl;
    init(v1,
1,5);
    init(v2,
3,8);
    cout 
<< "Vector v1: ";
    copy(v1.begin(),v1.end(),ostream_iterator
<int>(cout," "));
    cout 
<< endl;
    cout 
<< "Vector v2: ";
    copy(v2.begin(),v2.end(),ostream_iterator
<int>(cout," "));
    cout 
<< endl;
    cout 
<< "set_union operator on v1,v2: ";
    set_union(v1.begin(),v1.end(),v2.begin(),v2.end(),ostream_iterator
<int>(cout," "));
    cout 
<< endl << endl;
    
    init(v1,
1,5);
    init(v2,
3,8);
    cout 
<< "Vector v1: ";
    copy(v1.begin(),v1.end(),ostream_iterator
<int>(cout," "));
    cout 
<< endl;
    cout 
<< "Vector v2: ";
    copy(v2.begin(),v2.end(),ostream_iterator
<int>(cout," "));
    cout 
<< endl;
    cout 
<< "set_intersecion operator on v1,v2: ";
    set_intersection(v1.begin(),v1.end(),v2.begin(),v2.end(),ostream_iterator
<int>(cout," "));
    cout 
<< endl << endl;
    
    init(v1,
1,5);
    init(v2,
3,8);
    cout 
<< "Vector v1: ";
    copy(v1.begin(),v1.end(),ostream_iterator
<int>(cout," "));
    cout 
<< endl;
    cout 
<< "Vector v2: ";
    copy(v2.begin(),v2.end(),ostream_iterator
<int>(cout," "));
    cout 
<< endl;
    cout 
<< "set_difference operator, v1 to v2: ";
    set_difference(v1.begin(),v1.end(),v2.begin(),v2.end(),ostream_iterator
<int>(cout," "));
    cout 
<< endl;
    cout 
<< "set_difference operator, v2 to v1: ";
    set_difference(v2.begin(),v2.end(),v1.begin(),v1.end(),ostream_iterator
<int>(cout," "));
    cout 
<< endl << endl;
    
    init(v1,
1,5);
    init(v2,
3,8);
    cout 
<< "Vector v1: ";
    copy(v1.begin(),v1.end(),ostream_iterator
<int>(cout," "));
    cout 
<< endl;
    cout 
<< "Vector v2: ";
    copy(v2.begin(),v2.end(),ostream_iterator
<int>(cout," "));
    cout 
<< endl;
    cout 
<< "set_symmetric_difference operator, v1 to v2: ";
    set_symmetric_difference(v1.begin(),v1.end(),v2.begin(),v2.end(),ostream_iterator
<int>(cout," "));
    cout 
<< endl;
    cout 
<< "set_symmetric_difference operator, v2 to v1: ";
    set_symmetric_difference(v2.begin(),v2.end(),v1.begin(),v1.end(),ostream_iterator
<int>(cout," "));
    cout 
<< endl << endl;
    
return 0;
}

Includes operator:
Vector v1: 
1 2 3 4 5
Vector v2: 
1 2 3 4 5 6 7 8
v2 
is in v1 ? no
v1 
is in v2 ? yes

Vector v1: 
1 2 3 4 5
Vector v2: 
3 4 5 6 7 8
set_union 
operator on v1,v2: 1 2 3 4 5 6 7 8

Vector v1: 
1 2 3 4 5
Vector v2: 
3 4 5 6 7 8
set_intersecion 
operator on v1,v2: 3 4 5

Vector v1: 
1 2 3 4 5
Vector v2: 
3 4 5 6 7 8
set_difference 
operator, v1 to v2: 1 2
set_difference 
operator, v2 to v1: 6 7 8

Vector v1: 
1 2 3 4 5
Vector v2: 
3 4 5 6 7 8
set_symmetric_difference 
operator, v1 to v2: 1 2 6 7 8
set_symmetric_difference 
operator, v2 to v1: 1 2 6 7 8



patriking 2011-01-18 10:17 鍙戣〃璇勮
]]>
STL涔婱ergehttp://www.shnenglu.com/patriking/archive/2011/01/17/138692.htmlpatrikingpatrikingMon, 17 Jan 2011 13:35:00 GMThttp://www.shnenglu.com/patriking/archive/2011/01/17/138692.htmlhttp://www.shnenglu.com/patriking/comments/138692.htmlhttp://www.shnenglu.com/patriking/archive/2011/01/17/138692.html#Feedback0http://www.shnenglu.com/patriking/comments/commentRss/138692.htmlhttp://www.shnenglu.com/patriking/services/trackbacks/138692.htmlmerge鍚堝茍涓や釜鏈夊簭鐨剆equence錛岄粯璁や負<姣旇緝錛屽彲鑷畾涔夋瘮杈冨嚱鏁癱omp錛岀粨鏋滀繚瀛樺湪[result, result + (last1 - first1) + (last2 - first2)) 涓傚嚱鏁板畾涔夊涓嬶細
OutputIterator merge (InputIterator1 first1, InputIterator1 last1, InputIterator2 first2, InputIterator2 last2, OutputIterator result)
OutputIterator merge (InputIterator1 first1, InputIterator1 last1, InputIterator2 first2, InputIterator2 last2, OutputIterator result, Compare comp)

inplace_merge鍚堝茍涓涓腑鍓嶅悗涓ゆ鍒嗗埆鏈夊簭鐨勫簭鍒楋紝鍗砙first,middle)涓嶽middle,last)鍒嗗埆鏈夊簭錛屽悎騫惰繖涓や釜瀛愬簭鍒楋紝騫舵妸緇撴灉淇濆瓨鍦╗first,last錛変腑銆?br>inplace_merge (BidirectionalIterator first, BidirectionalIterator middle, BidirectionalIterator last);
inplace_merge (BidirectionalIterator first, BidirectionalIterator middle, BidirectionalIterator last, Compare comp);

#include<string>
#include
<algorithm>
#include
<iostream>
#include
<iterator>
#include
<vector>
using namespace std;
int main()
{
    vector
<int>v1;
    vector
<int>v2;
    vector
<int>v3;
    vector
<int>::iterator vecitr;
    
for(int i = 1; i <= 10; i++){
        v1.push_back(i
%7);
        v2.push_back(i
%4);
    }
    sort(v1.begin(),v1.end());
    cout 
<< "Fisrt vecter: ";
    copy(v1.begin(),v1.end(),ostream_iterator
<int>(cout," "));
    cout 
<< endl << endl;
    sort(v2.begin(),v2.end());
    cout 
<< "Second vecter: ";
    copy(v2.begin(),v2.end(),ostream_iterator
<int>(cout," "));
    cout 
<< endl << endl;
    cout 
<< "Merge this two vecter: ";
    merge(v1.begin(),v1.end(),v2.begin(),v2.end(),ostream_iterator
<int>(cout," "));
    cout 
<< endl << endl;
    
for(int i = 1; i <= 10; i++){
        v3.push_back(i
%7);
    }
    sort(v3.begin(),v3.end());
    
int x = v3.size();
    
for(int i = 1; i <= 10; i++){
        v3.push_back(i
%4);
    }
    vecitr 
= v3.begin();
    advance(vecitr,x);
    sort(vecitr,v3.end());
    cout 
<< "Third vecter: ";
    copy(v3.begin(),v3.end(),ostream_iterator
<int>(cout," "));
    cout 
<< endl << endl;
    cout 
<< "inplace_Merge third vecter: ";
    inplace_merge(v3.begin(),vecitr,v3.end());
    copy(v3.begin(),v3.end(),ostream_iterator
<int>(cout," "));
    cout 
<< endl << endl;
    return 0;
}
Fisrt vecter: 0 1 1 2 2 3 3 4 5 6

Second vecter: 
0 0 1 1 1 2 2 2 3 3

Merge 
this two vecter: 0 0 0 1 1 1 1 1 2 2 2 2 2 3 3 3 3 4 5 6

Third vecter: 
0 1 1 2 2 3 3 4 5 6 0 0 1 1 1 2 2 2 3 3

inplace_Merge third vecter: 
0 0 0 1 1 1 1 1 2 2 2 2 2 3 3 3 3 4 5 6




patriking 2011-01-17 21:35 鍙戣〃璇勮
]]>
STL涔婤inary searchhttp://www.shnenglu.com/patriking/archive/2011/01/16/138617.htmlpatrikingpatrikingSun, 16 Jan 2011 14:40:00 GMThttp://www.shnenglu.com/patriking/archive/2011/01/16/138617.htmlhttp://www.shnenglu.com/patriking/comments/138617.htmlhttp://www.shnenglu.com/patriking/archive/2011/01/16/138617.html#Feedback0http://www.shnenglu.com/patriking/comments/commentRss/138617.htmlhttp://www.shnenglu.com/patriking/services/trackbacks/138617.html
ForwardIterator lower_bound (ForwardIterator first,ForwardIterator last, const T& value)
ForwardIterator lower_bound (ForwardIterator first,ForwardIterator last, const T& value, Compare comp)
//鏌ユ壘鏈榪滅殑涓涓猧terator i錛?浣垮緱[first,i)閲岄潰鐨勪換鎰忎竴涓猧terator j錛屾湁 *j < value or comp(*j,value)==true.

ForwardIterator upper_bound (ForwardIterator first,ForwardIterator last, const T& value)
ForwardIterator upper_bound (ForwardIterator first,ForwardIterator last, const T& value, Compare comp)
//鏌ユ壘鏈榪滅殑涓涓猧terator i錛?浣垮緱[first,i)閲岄潰鐨勪換鎰忎竴涓猧terator j錛屾湁 !(*j < value) or comp(*j,value)==false.

pair equal_range(ForwardIterator first, ForwardIterator last, const T& value)
pair equal_range(ForwardIterator first, ForwardIterator last, const T& value, Compare comp)
//鏌ユ壘鏈澶х殑subrange[i,j)錛屼嬌寰椾換鎰忎竴涓猧terator in [i,j)婊¤凍!(*k<value) && !(value<*k) or comp(*k,value)==false && comp(value,*k)==false.

bool binary_search (ForwardIterator first, ForwardIterator last, const T& value)
bool binary_search (ForwardIterator first, ForwardIterator last, const T& value, Compare comp)
// 鏌ユ壘鏄惁鍦╗first,last)涓瓨鍦╥terator i,婊¤凍 !(*i<value) && !(value<*i) or comp(*i,value)==false && comp(value,*i)==false
// 瀛樺湪鍒欒繑鍥瀟rue,鍚﹀垯榪斿洖false. 

#include<algorithm>
#include
<iostream>
#include
<vector>
#include
<iterator>
using namespace std;
int main()
{
    vector
<int>v;
    vector
<int>::iterator itr;
    pair
< vector<int>::iterator, vector<int>::iterator >vecpair;
    
    
for(int i = 1; i <= 20; i++){
        v.push_back(i
%6);
    }
    sort(v.begin(),v.end());
    cout 
<< "array: " << endl << "    ";
    copy(v.begin(),v.end(),ostream_iterator
<int>(cout," "));
    cout 
<< endl;
    
    
//lower_bound
    cout << "lower_bound function, value = 3:" << endl; 
    itr 
= lower_bound(v.begin(),v.end(),3);
    cout 
<< "    [first, itr) = ";
    copy(v.begin(),itr,ostream_iterator
<int>(cout," "));
    cout 
<< endl;
    cout 
<< "    [itr, last) = ";
    copy(itr,v.end(),ostream_iterator
<int>(cout," "));
    cout 
<< endl << endl;
    
    
// upper_bound
    cout << "upper_bound function, value = 3:" << endl; 
    itr 
= upper_bound(v.begin(),v.end(),3);
    cout 
<< "    [first, itr) = ";
    copy(v.begin(),itr,ostream_iterator
<int>(cout," "));
    cout 
<< endl;
    cout 
<< "    [itr, last) = ";
    copy(itr,v.end(),ostream_iterator
<int>(cout," "));
    cout 
<< endl << endl;
    
    
// equal_range
    cout << "equal_range function, value = 3:" << endl; 
    vecpair 
= equal_range(v.begin(),v.end(),3);
    
    cout 
<< "    [vecpair->first, vecpair->second) = ";
    copy(vecpair.first, vecpair.second, ostream_iterator
<int>(cout," "));
    cout 
<< endl << endl;
    
    
//binary_search, value = 3
    cout << "binary_search function, value = 3:" << endl;
    cout 
<< "3 is " << (binary_search(v.begin(),v.end(),3? "":"not "<< "in array." << endl;
    cout 
<< endl;
    
    
//binary_search, value = 6
    cout << "binary_search function, value = 6:" << endl;
    cout 
<< "6 is " << (binary_search(v.begin(),v.end(),6? "":"not "<< "in array." << endl;
    cout 
<< endl;
    
    
return 0;    
}
 

array:
    
0 0 0 1 1 1 1 2 2 2 2 3 3 3 4 4 4 5 5 5
lower_bound function, value 
= 3:
    [first, itr) 
= 0 0 0 1 1 1 1 2 2 2 2
    [itr, last) 
= 3 3 3 4 4 4 5 5 5

upper_bound function, value 
= 3:
    [first, itr) 
= 0 0 0 1 1 1 1 2 2 2 2 3 3 3
    [itr, last) 
= 4 4 4 5 5 5

equal_range function, value 
= 3:
    [vecpair
->first, vecpair->second) = 3 3 3

binary_search function, value 
= 3:
3 is in array.

binary_search function, value 
= 6:
6 is not in array.




patriking 2011-01-16 22:40 鍙戣〃璇勮
]]>
sscanf and scanf鍑芥暟%[]鐢ㄦ硶http://www.shnenglu.com/patriking/archive/2011/01/15/138579.htmlpatrikingpatrikingSat, 15 Jan 2011 11:54:00 GMThttp://www.shnenglu.com/patriking/archive/2011/01/15/138579.htmlhttp://www.shnenglu.com/patriking/comments/138579.htmlhttp://www.shnenglu.com/patriking/archive/2011/01/15/138579.html#Feedback1http://www.shnenglu.com/patriking/comments/commentRss/138579.htmlhttp://www.shnenglu.com/patriking/services/trackbacks/138579.html    %[]琛ㄧず瑕佽鍏ヤ竴涓瓧絎﹂泦鍚? 濡傛灉[鍚庨潰絎竴涓瓧絎︽槸”^”錛屽垯琛ㄧず鍙嶆剰鎬濄?br>    []鍐呯殑瀛楃涓插彲浠ユ槸1鎴栨洿澶氬瓧絎︾粍鎴愩傜┖瀛楃闆嗭紙%[]錛夋槸榪濆弽瑙勫畾鐨勶紝鍙鑷翠笉鍙鐭ョ殑緇撴灉錛屽悓鏍?[^]涔熸槸榪濆弽瑙勫畾鐨勩?br>渚嬪: %[a-z]璇誨彇鍦╝-z涔嬮棿鐨勫瓧絎︿覆錛屽鏋滀笉鍦ㄦ涔嬪墠鍒欏仠姝紝濡?br>          char s[]="hello, my friend” ; // 娉ㄦ剰: ,閫楀彿鍦ㄤ笉 a-z涔嬮棿
          sscanf( s, “%[a-z]”, string ) ; // string=hello
      %[^a-z] 璇誨彇涓嶅湪a-z涔嬮棿鐨勫瓧絎︿覆錛屽鏋滅鍒癮-z涔嬮棿鐨勫瓧絎﹀垯鍋滄錛屽
          char s[]="HELLOkitty” ; // 娉ㄦ剰: ,閫楀彿鍦ㄤ笉 a-z涔嬮棿
          sscanf( s, “%[^a-z]”, string ) ; // string=HELLO
      %*[^=] 鍓嶉潰甯?* 鍙瘋〃紺轟笉淇濆瓨鍙橀噺,璺寵繃絎﹀悎鏉′歡鐨勫瓧絎︿覆銆?br>          char s[]="notepad=1.0.0.1001" ;
          char szfilename [32] = "" ;
          int i = sscanf( s, "%*[^=]", szfilename ) ; // szfilename=NULL,鍥犱負娌′繚瀛?br>          int i = sscanf( s, "%*[^=]=%s", szfilename ) ; // szfilename=1.0.0.1001



patriking 2011-01-15 19:54 鍙戣〃璇勮
]]>
亚洲天堂久久精品| 久久人妻少妇嫩草AV蜜桃| 精品国产日韩久久亚洲| 7777精品久久久大香线蕉| 精品久久久久久久无码| 久久天天躁狠狠躁夜夜2020老熟妇| 色婷婷久久综合中文久久一本| 一本久久知道综合久久| 国产精品99久久免费观看| 久久久久久久久久免免费精品 | 久久天天躁狠狠躁夜夜网站| 国产精品99久久不卡| 波多野结衣中文字幕久久| 久久精品一区二区三区中文字幕| 亚洲AV无码久久精品成人 | 久久综合狠狠综合久久激情 | 日本精品久久久久久久久免费| 国产午夜免费高清久久影院| 久久乐国产综合亚洲精品| 久久综合综合久久狠狠狠97色88| 欧洲成人午夜精品无码区久久| 久久精品国产亚洲Aⅴ蜜臀色欲| 99久久久精品免费观看国产| 久久人妻无码中文字幕| 久久SE精品一区二区| 久久久久国产精品嫩草影院| 久久精品www| 久久精品国产清自在天天线| 中文字幕成人精品久久不卡| 久久精品aⅴ无码中文字字幕重口| 国产亚洲色婷婷久久99精品| 亚洲精品蜜桃久久久久久| 久久国产欧美日韩精品| 久久乐国产综合亚洲精品| 久久笫一福利免费导航| 无码八A片人妻少妇久久| 久久午夜无码鲁丝片秋霞 | 国产99久久久国产精品~~牛| 久久精品国产免费| 久久激情五月丁香伊人| 三级韩国一区久久二区综合|