UVa814 - The Letter Carrier's Rounds
来源:互联网 发布:南方电网 大数据 编辑:程序博客网 时间:2024/05/21 11:17
终于感觉到一个简单的题
#include<iostream>#include<string>#include<vector>#include<set>#include<map>using namespace std;void parse_address(const string& s, string& user, string& mta){ int k = s.find('@'); user = s.substr(0, k); mta = s.substr(k+1);}int main(){ int k; string s, t, user1, mta1, user2, mta2; set<string> addr; while(cin >> s && s != "*"){ cin>>s>>k; while(k--) { cin>>t; addr.insert(t+"@"+s); } } while(cin>>s&&s!="*"){ parse_address(s, user1, mta1); vector<string> mta; map<string, vector<string> >dest; set<string> vis; while(cin>>t && t!="*"){ parse_address(t, user2, mta2); if(vis.count(t)) continue; vis.insert(t); if(!dest.count(mta2)) { mta.push_back(mta2); dest[mta2]=vector<string>(); } dest[mta2].push_back(t); } getline(cin,t); string data; while(getline(cin,t) && t[0]!='*') data += (" " + t + "\n"); for(int i=0;i<mta.size();i++){ string mta2=mta[i]; vector<string> users = dest[mta2]; cout<<"Connection between "<<mta1<<" and "<<mta2<<endl; cout<<" HELO "<<mta1<<"\n"; cout<<" 250\n"; cout<<" MAIL FROM:<"<<s<<">\n";cout<<" 250\n"; bool ok=false; for(int i=0;i<users.size();i++){ cout<<" RCPT TO:<"<<users[i]<<">\n"; if(addr.count(users[i])) { ok=true; cout<<" 250\n"; } else cout<<" 550\n"; } if(ok){ cout<<" DATA\n";cout<<" 354\n"; cout<<data; cout<<" .\n"; cout<<" 250\n"; } cout<<" QUIT\n"; cout<<" 221\n"; } } return 0;}
0 0
- UVa814 - The Letter Carrier's Rounds
- uva814-The letter Carrier's Rounds
- 814 - The Letter Carrier's Rounds
- 814 - The Letter Carrier's Rounds
- uva 814 The Letter Carrier's Rounds
- The letter Carrier's Rounds(Uva 814)
- The Letter Carrier's Rounds UVA
- uva 814 The Letter Carrier's Rounds
- UVa 814 - The Letter Carrier's Rounds(模拟)
- The Letter Carrier's Rounds(UVa 814)
- 814-The Letter Carrier's Rounds【模拟、STL、被坑了】
- VUA814-The Letter Carrier's Rounds(入门经典5-11,PE)
- 例题5-11 UVA 814 The Letter Carrier’s Rounds邮件传输代理的交互
- UVa 814 The Lettter Carrier's Rounds
- How To get the usbdisk's drive letter properly
- Lesson Forty-Five The boss's letter. 老板的信.
- Lesson 45 The boss's letter 老板的信
- Carrier Ethernet: Providing the Need for Speed
- UVA - 1103 Ancient Messages(三组数据)
- 无线局域网
- [数据结构笔记-概述]
- android中的后退键——onBackPressed()的使用
- Use Goldengate Initial Data Load
- UVa814 - The Letter Carrier's Rounds
- Linux 中的 I2C 协议
- OC排序
- [科普]原码,反码,补码由来
- win7 IIS配置PHP
- glOrtho与gluPerspective比较
- 计算机网络简述
- Windows核心编程笔记(7)----内核模式下的线程同步
- [LeetCode] 008. String to Integer (Easy) (C++/Java/Python)