814
来源:互联网 发布:淘宝买汽车靠谱吗 编辑:程序博客网 时间:2024/04/30 02:17
题目链接:点击打开链接
#include <iostream> #include <cstdio> #include <string> #include <set> #include <map> #include <vector> using namespace std; void parse_address(string const s, string& user, string& mta) { int t = s.find('@'); user = s.substr(0, t); mta = s.substr(t + 1); } int main() { #ifndef ONLINE_JUDGE freopen("test", "r", stdin); #endif // ONLINE_JUDGE int k; string s, t, user1, user2, mta1, mta2; set<string> addr; while(cin >> s&& s[0] != '*') { cin >> t >> k; while(k--) {cin >> s; addr.insert(s + '@' + t);} } while(cin >> s&& s[0] != '*') { parse_address(s, user1, mta1); vector<string> mta; map<string, vector<string> > dest; set<string> vis; while(cin >> t&& t[0] != '*') { if(vis.count(t)) continue; vis.insert(t); parse_address(t, user2, mta2); 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++) { mta2 = mta[i]; vector<string> users = dest[mta2]; cout << "Connection between " << mta1 << " and " << mta2 << "\n"; cout << " HELO "<< mta1 << "\n"; cout << " 250\n"; cout << " MAIL FROM:<" << user1 << "@" << mta1 << ">\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 354\n"; cout << data; cout << " .\n" << " 250\n"; } cout << " QUIT\n 221\n"; } } return 0; }
1 0
- 814
- nyoj 814
- 814B
- 814D
- UVA 814 MTA 模拟
- codeforces 814A
- 814 又见拦截导弹
- UVA 814 SMTP协议模拟
- codeforces 814D(25/600)
- SRM 814 Div 1 ElectionFraudDiv1(250pt)
- nyoj 814 又见导弹拦截
- NYOJ 814 又见拦截导弹
- NYOJ 814 又见拦截导弹
- nyoj 814 又见拦截导弹
- nyoj 814 又见拦截导弹
- 814 - The Letter Carrier's Rounds
- 814 - The Letter Carrier's Rounds
- 南阳oj 814 又见拦截导弹
- 敌兵布阵
- 1040. 有几个PAT(25)
- 【ACM】P2006、P2007、P2008、P2009、P2010代码演示
- coredump产生
- Linux if语句内判断参数
- 814
- 最小生成树之rst
- 【JavaScript】颗粒归仓
- Qt如何隐藏ListWidget的滚动条
- UVA_489
- 【English】四月英语总结
- windows10+python3环境搭建
- smartTabLayout参数详解
- python报告 No module named 'main'错误