ZOJ Problem Set - 1243 URLs
来源:互联网 发布:解封电脑机器码软件 编辑:程序博客网 时间:2024/06/14 08:41
这道题思路容易乱。注意看题。
#include <iostream>#include <cstdio>#include <cstring>using namespace std;int main(){ //freopen("a.txt","r",stdin); int cas,cnt,i,len; string str; cin>>cas; cnt = 0; while(cnt < cas) { cin>>str; cout<<"URL #"<<++cnt<<endl; len = str.size(); cout<<"Protocol = "; if(str[0] == 'f') cout<<"ftp"<<endl; else if(str[0] == 'h') cout<<"http"<<endl; else cout<<"gopher"<<endl; cout<<"Host = "; for(i = 2;i < len;i ++) if(str[i]=='/'&&str[i-1] == '/') break; i++; while(i < len) { if(str[i] == '/') break; if(str[i] == ':') break; cout<<str[i ++]; } cout<<endl; if(i == len){ cout<<"Port = <default>"<<endl; cout<<"Path = <default>"<<endl; } else { if(str[i] == ':') { cout<<"Port = "; i++; while(i < len) { if(str[i] == '/') break; cout<<str[i ++]; } cout<<endl; if(i < len){ i++; cout<<"Path = "; while(i < len) cout<<str[i ++]; cout<<endl; } else cout<<"Path = <default>"<<endl; } else {cout<<"Port = <default>"<<endl; if(i < len){ i++; cout<<"Path = "; while(i < len) cout<<str[i ++]; cout<<endl; } else cout<<"Path = <default>"<<endl; } } cout<<endl; }}
- ZOJ Problem Set - 1243 URLs
- ZOJ 1243 URLs
- zoj 1243 URLs
- zoj 1243 URLs
- ZOJ 1243 URLs
- ZOJ 1243 URLs
- ZOJ 1243 URLs
- ZOJ 1243 URLs
- ZOJ 1243 URLs
- ZOJ Problem Set - 2060
- ZOJ Problem Set - 2972
- ZOJ Problem Set - 1037
- ZOJ Problem Set - 1048
- ZOJ Problem Set - 1049
- ZOJ Problem Set - 1051
- ZOJ Problem Set - 1067
- ZOJ Problem Set - 1115
- ZOJ Problem Set - 1151
- UDP穿透NAT的原理与实现(附源代码)
- [EDI]实例解释EDI的应用及其协议标准
- netbeans快捷键失败效
- local_listener 与 remote_listener 参数说明
- AT原理
- ZOJ Problem Set - 1243 URLs
- 黑马程序员_我的黑马程序员之路
- 数字集成电路经典教材
- __attribute__宏与link脚本的用法
- for_each用法
- 用C#创建XML
- 通过数据库服务器触发器控制机器访问
- [IT 男人帮 -11/03] 几个软件研发团队管理的小问题
- Windows下多线程常用函数