poj 1250 Tanning Salon
2012-06-05 19:23
232 查看
#include <iostream> #include <vector> #include <string> #include <algorithm> using namespace std; vector<char> v; vector<char>::iterator it; int main() { int customers, i, len, ans, size; string str; while (cin >> customers && customers) { cin >> str; len = str.length(); v.clear(); ans = 0; for (i = 0; i < len; i++) { size = v.size(); it = find(v.begin(), v.end(), str[i]); if (customers > size && it == v.end()) v.push_back(str[i]); else if (customers >= size && it != v.end()) v.erase(it); else if (customers == size && it == v.end()) { ans++; continue; } else ans++; } if (ans == 0) cout << "All customers tanned successfully." << endl; else cout << ans/2 << " customer(s) walked away." << endl; } system("pause"); }
相关文章推荐
- POJ 1250 Tanning Salon
- POJ 1250 Tanning Salon
- POJ 1250 Tanning Salon(我的水题之路——字母表数组标记)
- poj 1250 Tanning Salon
- POJ1250 Tanning Salon 简单模拟
- poj 1250 Tanning Salon(模拟)
- poj 1250 Tanning Salon
- POJ 1250 Tanning Salon
- poj1250 Tanning Salon
- poj1250 Tanning Salon
- poj 1250 Tanning Salon 【模拟题】
- poj 1250 Tanning Salon
- POJ 1250 Tanning Salon(简单模拟)
- poj 1250 Tanning Salon
- POJ 题目1250 Tanning Salon (链表应用)
- POJ-1250-Tanning Salon
- poj 1250 Tanning Salon(模拟)
- poj 1250(Tanning Salon)
- POJ1250:Tanning Salon
- POJ - 1250 Tanning Salon