hdu 1106

不明白为什么每一道水题我都写的这么辛苦。

/*
  ID:狂人
  num:09073355
  E-mail:wenboguo@live.com
*/
#include <vector>
#include <list>
#include <assert.h>
#include <map>
#include <set>
#include <deque>
#include <queue>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <fstream>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <fstream>

using namespace std;

#define REP(i,n) for(int i=0; i<(n); ++i)
#define FOR(i,a,b) for(int i=(a);i<=(b);++i)
#define FORD(i,a,b) for(int i=(a);i>=b;--i)
#define FOREACH(it,c) for(typeof((c).begin()) it=(c).begin();it!=(c).end();++it)
#define ALL(c) (c).begin(),(c).end()

#define debug(x) cerr<< #x << " = " << (x) << "\n";
#define debugv(v) cerr << #v << " = "; FOREACH(it,v) cerr << *it <<","; cerr << "\n";
#define SIZE(a)  (int(a.size()))
#define mp make_pair
#define pb push_back

template<typename T> inline void checkMax(T& a, T b) {if (b>a) a=b;}
template<typename T> inline void checkMin(T& a, T b) {if (b<a) a=b;}

typedef long long LL;
typedef vector<int> VI;
typedef vector<string> VS;
typedef pair<int,int>  ii;
typedef pair<string, string>ss;
typedef long double ld;
const int INF = 0x7ffffff;
const int Maxl = 102;

//结构体内重载‘<’,使优先队列可以对其进行排序

struct Node{
	string str1;
	string str2;

	Node(string st1, string st2):str1(st1),str2(st2){}

	bool operator < (const Node &a) const
	{
		return a.str1 < str1;
	}
};

int main(void)
{
//ifstream cin ("aaa.txt");
	string str;
	
	while(cin >> str)
	{
		priority_queue<int ,vector<int>, greater<int> >my_que;
		//my_que.clear();
		int st = 0, en = 0;
		while (st < str.size())
		{
			int num = 0;

			while (str[st] == '5')	//去掉连续5的情况
			{
				st++;
			}

			for (en = st; en <= str.size(); en++){
				if (en != str.size())
				{
					if (str[en] == '5')
					{
						break;
					}
				}
				else
					break;
			}	//如果遇到连续几个5的情况就会不行了
			for (int i = st,j = en-1; i <= j; i++)
			{
				num *= 10;
				num += str[i] - '0';
			}
			if (st > en-1)
			{
				continue;
			}
			my_que.push(num);
			st = en + 1;

			
		}
		while(my_que.size() != 1)
		{
			cout << my_que.top() << " ";
			my_que.pop();
		}

		cout << my_que.top() << endl;
	}
//system("pause");
    return 0;
}

 


 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值