玩心未泯

卡尔斯希普拉斯

C++博客 首页 新随笔 联系 聚合 管理
  19 Posts :: 0 Stories :: 98 Comments :: 0 Trackbacks
       祝各位Cpper们6.1儿童节快乐。 
     
       大家都要注意身体啊。

       大家都要保持年轻心态啊。

       大家都要快乐快乐快快乐乐啊。
posted on 2007-05-31 17:29 SuperPlayeR 阅读(631) 评论(2)  编辑 收藏 引用 所属分类: 东弹西扯

评论

# re: 6.1儿童节快乐 2007-06-01 16:10 zenith
六一啦,给自己残留的童心放个假吧.建议一:在房间裸爬;二:在床上蹦床;三:可以尝试穿开裆裤和随意大小便;四:.....  回复  更多评论
  

# re: 6.1儿童节快乐 2011-10-14 14:38 Fuxking
#include <iostream>
#include <vector>
#include <string>
using namespace std;


int main()
{
vector<int> candy;
string command;
int n,m;
void respond(char,int,int,int,vector<int> &);
cin>>n>>m;
while(n!=0&&m!=0)
{
getchar();
candy.assign(n,0);
while(m--!=0)
{
getline(cin,command);
char flag=command[0];
int first=atoi(&command[2]);
int second=atoi(&command[4]);
int third= (flag=='I')? atoi(&command[6]): -1;
respond(flag,first,second,third,candy);
}
cin>>n>>m;
candy.clear();
}
return 0;
}

void respond(char flag,int first,int second,int third,vector<int> &vec)
{
if(flag=='I')
{
for(;first<=second;++first)
{
vec[first-1]+=third;
}
}
else
{
int max_position=first;
for(++first;first<=second;++first)
{
if(vec[first-1]>vec[max_position-1])
{
max_position=first;
}
}
cout<<vec[max_position-1]<<endl;
vector<int>::iterator it=vec.begin();
vec.erase(it+max_position-1);
}
}  回复  更多评论
  


只有注册用户登录后才能发表评论。
网站导航: 博客园   IT新闻   BlogJava   知识库   博问   管理