锘??xml version="1.0" encoding="utf-8" standalone="yes"?>中文字幕成人精品久久不卡,伊人久久大香线蕉综合热线,久久人人爽人人爽人人AV东京热 http://www.shnenglu.com/xmli/category/9027.html銇烽洩椋樼粵姊呮槧孌嬬孩 <br> &nbsp;&nbsp; 銇瘋姳鑸為湝椋炴槧鑻嶆澗<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;----- Do more,suffer lesszh-cnWed, 03 Dec 2008 08:36:25 GMTWed, 03 Dec 2008 08:36:25 GMT60Friday the Thirteenthhttp://www.shnenglu.com/xmli/archive/2008/12/03/68462.html鏉庣幇姘?/dc:creator>鏉庣幇姘?/author>Wed, 03 Dec 2008 06:00:00 GMThttp://www.shnenglu.com/xmli/archive/2008/12/03/68462.htmlhttp://www.shnenglu.com/xmli/comments/68462.htmlhttp://www.shnenglu.com/xmli/archive/2008/12/03/68462.html#Feedback0http://www.shnenglu.com/xmli/comments/commentRss/68462.htmlhttp://www.shnenglu.com/xmli/services/trackbacks/68462.html棰樼洰錛?a >Friday the Thirteenth

綆絳旓細


/*
ID: lixianm1
PROG: friday
LANG: C++
*/
#include 
<fstream>
#include 
<iostream>
#include 
<vector>
#include 
<map>
#include 
<string>
#include 
<cassert>

inline 
bool IsLeapYear(unsigned int nYear) {return ((!(nYear&3))&&(0!=nYear%100))||(0==nYear%400);}

int main(int argc, char* argv[]) 
{    
    
//////////////////////////////////////////////////////////////////////////open the file
    std::string strInFile    = "friday.in";
    std::
string strOutFile    = "friday.out";

    std::ifstream fin(strInFile.c_str());
    std::ofstream fout(strOutFile.c_str());

    
if (!fin)
    {
        std::cout
<<"failed to open file for read"<<std::endl;
        
return 1;
    }
    
if (!fout)
    {
        std::cout
<<"failed to open file for write"<<std::endl;
        fin.close();
        
return 1;
    }
    
//////////////////////////////////////////////////////////////////////////read file and init all variables
    

    
int N;
    fin
>>N;

    
//////////////////////////////////////////////////////////////////////////process

    
static int month_day[]={0312831303130313130313031};
    
static int month_day2[]={0312931303130313130313031};

    
int aWeekCount[7]={0};
    unsigned 
int nTotalDays= 0;

    
for (int i=0; i<N; ++i)
    {
        
for (int nMonth=1; nMonth<13++nMonth)
        {
            
++aWeekCount[(nTotalDays+12)%7];
            
            
if (!IsLeapYear(1900+i))
            {
                nTotalDays
+=month_day[nMonth];
            }
else
            {
                nTotalDays
+=month_day2[nMonth];
            }            
        }        
    }
    
    
//////////////////////////////////////////////////////////////////////////write the process result
    for (int i=0; i<6++i)
    {
        fout
<<aWeekCount[(i+5)%7]<<" ";
    }
    fout
<<aWeekCount[4]<<std::endl;

    
//////////////////////////////////////////////////////////////////////////end and exit
    fin.close();
    fout.close();

    
//system("pause");
    return 0;
}



]]>
Your Ride Is Herehttp://www.shnenglu.com/xmli/archive/2008/12/02/68399.html鏉庣幇姘?/dc:creator>鏉庣幇姘?/author>Tue, 02 Dec 2008 08:18:00 GMThttp://www.shnenglu.com/xmli/archive/2008/12/02/68399.htmlhttp://www.shnenglu.com/xmli/comments/68399.htmlhttp://www.shnenglu.com/xmli/archive/2008/12/02/68399.html#Feedback0http://www.shnenglu.com/xmli/comments/commentRss/68399.htmlhttp://www.shnenglu.com/xmli/services/trackbacks/68399.htmlYour Ride Is Here
  榪樻槸姣旇緝綆鍗曠殑

  綆絳旓細


/*
ID: lixianm1
PROG: ride
LANG: C++
*/
#include 
<fstream>
#include 
<iostream>
#include 
<string>

unsigned 
int hash(const std::string& s)
{
    unsigned 
int nNum    = 1;
    unsigned 
int nSize    = s.length();
    
for (int i= 0; i<nSize; ++i)
    {
        nNum
*=(s[i]-'A'+1);
    }
    
return nNum%47;
}

int main(int argc, char* argv[]) 
{    
    std::
string strInFile    = "ride.in";
    std::
string strOutFile    = "ride.out";

    std::ifstream fin(strInFile.c_str());
    
if (!fin)
    {
        std::cout
<<"failed to open file for read"<<std::endl;
        
return 1;
    }

    std::
string strComet, strGroup;
    std::getline(fin, strComet);
    std::getline(fin, strGroup);
    fin.close();

    std::ofstream fout(strOutFile.c_str());
    
if (!fout)
    {
        std::cout
<<"failed to open file for write"<<std::endl;
        
return 1;
    }

    
if (hash(strComet)==hash(strGroup))
    {
        fout
<<"GO"<<std::endl;
    }
else
    {
        fout
<<"STAY"<<std::endl;
    }
    fout.close();
    
    
return 0;
}



]]>
Greedy Gift Givershttp://www.shnenglu.com/xmli/archive/2008/12/02/68398.html鏉庣幇姘?/dc:creator>鏉庣幇姘?/author>Tue, 02 Dec 2008 08:13:00 GMThttp://www.shnenglu.com/xmli/archive/2008/12/02/68398.htmlhttp://www.shnenglu.com/xmli/comments/68398.htmlhttp://www.shnenglu.com/xmli/archive/2008/12/02/68398.html#Feedback0http://www.shnenglu.com/xmli/comments/commentRss/68398.htmlhttp://www.shnenglu.com/xmli/services/trackbacks/68398.htmlGreedy Gift Givers
  棰樼洰鏈瘮杈冪畝鍗曪紝浣嗘垜璇諱簡鍗婂ぉ鎵嶇畻璇繪噦錛岃嫳鏂囨按騫寵窡涓嶄笂浜嗐?br>  棰樼洰澶ф剰錛氭湁NP涓漢錛屾瘡涓漢閮藉悜鍏朵粬浜洪侀挶錛屽悓鏃朵粬鍙堜細鏀跺埌鍒漢閫佺粰浠栫殑閽便傞鐩姹傝綆楁瘡涓漢鏀跺埌鐨勯挶姣旈佸嚭鐨勯挶澶氬灝戙?br>
瑙g瓟錛?br>

/*
ID: lixianm1
PROG: gift1
LANG: C++
*/
#include 
<fstream>
#include 
<iostream>
#include 
<vector>
#include 
<map>
#include 
<string>
#include 
<cassert>

typedef std::vector
<std::string>    StrVector;

struct Person
{
    std::
string    name;            // name
    int            money_send;        // money for sending
    int            money_receive;    // money received
    StrVector    receiver;        // all receivers

    Person()
    {
        money_send        
= 0;
        money_receive    
= 0;
    }
};

typedef std::map
<std::string, Person>    PersonMap;

int main(int argc, char* argv[]) 
{    
    
//////////////////////////////////////////////////////////////////////////open the file
    std::string strInFile    = "gift1.in";
    std::
string strOutFile    = "gift1.out";

    std::ifstream fin(strInFile.c_str());
    std::ofstream fout(strOutFile.c_str());

    
if (!fin)
    {
        std::cout
<<"failed to open file for read"<<std::endl;
        
return 1;
    }
    
if (!fout)
    {
        std::cout
<<"failed to open file for write"<<std::endl;
        fin.close();
        
return 1;
    }
    
//////////////////////////////////////////////////////////////////////////read file and init all variables
    int            nPersonNum;
    PersonMap    mPerson;
    StrVector    vPersonName;

    fin
>>nPersonNum;
    assert(nPersonNum
>0);
    
for(int i=0; i<nPersonNum; ++i)
    {
        Person    person;
        fin
>>person.name;
        mPerson[person.name]
= person;
        vPersonName.push_back(person.name);
    }
    
    std::
string strName;
    
while(fin>>strName)
    {
        fin
>>mPerson[strName].money_send;
        
int nReceiver;
        fin
>>nReceiver;
        std::
string strReceiverName;
        
for (int i=0; i<nReceiver; ++i)
        {
            fin
>>strReceiverName;
            mPerson[strName].receiver.push_back(strReceiverName);
        }        
    }    

    
//////////////////////////////////////////////////////////////////////////process
    
    
for (PersonMap::iterator iter= mPerson.begin(); mPerson.end()!=iter; ++iter)
    {
        Person
&    person    = iter->second;
        
int nReceiverNum    = person.receiver.size();
        
if ((0!=nReceiverNum))
        {
            
int nMoneySend        = person.money_send/nReceiverNum;

            
for (int i=0; i<nReceiverNum; ++i)
            {
                mPerson[person.receiver[i]].money_receive
+= nMoneySend;
            }

            person.money_send    
= nMoneySend*nReceiverNum;
        }
    }
    
//////////////////////////////////////////////////////////////////////////write the process result
    for (StrVector::iterator iter= vPersonName.begin(); vPersonName.end()!=iter; ++iter)
    {
        fout
<<*iter<<" "<<mPerson[*iter].money_receive-mPerson[*iter].money_send<<std::endl;
    }

    
//////////////////////////////////////////////////////////////////////////end and exit
    fin.close();
    fout.close();
    
//system("pause");
    return 0;
}




]]>
久久精品女人天堂AV麻| 国产999精品久久久久久| 久久精品无码一区二区WWW| 国内精品久久久久伊人av| 久久综合视频网站| 国产精品一区二区久久| 亚洲狠狠婷婷综合久久蜜芽| 久久成人国产精品一区二区| 91久久精品91久久性色| 色欲久久久天天天综合网精品| 丰满少妇高潮惨叫久久久| 91精品国产高清久久久久久国产嫩草| 国产成人精品三上悠亚久久| 日本亚洲色大成网站WWW久久| 夜夜亚洲天天久久| 亚洲国产婷婷香蕉久久久久久| 久久精品成人免费看| 国内精品久久国产| 久久久久99这里有精品10| 免费一级做a爰片久久毛片潮| 国产成人久久AV免费| 人妻中文久久久久| 91精品国产91久久| 久久亚洲欧美国产精品| 久久99精品久久久久久| 久久精品人妻中文系列| 久久久久国产| 99久久综合国产精品二区| 久久国产亚洲精品无码| 久久亚洲欧美日本精品| 久久伊人色| 久久久久人妻一区精品| 久久精品国产国产精品四凭| 久久这里只有精品首页| MM131亚洲国产美女久久| 久久精品国产亚洲AV无码偷窥| 精品无码久久久久国产动漫3d| 久久精品中文字幕第23页| 精品久久久久久久久久中文字幕 | 久久久久久亚洲Av无码精品专口| 久久久久人妻一区二区三区|