ZOJ 1243 URLs
2014-04-06 11:14
225 查看
#include<stdio.h>
#include<string.h>
int main()
{
int n,no=1,i,j,len,biaoji;
char str[80],*p;
char information[]={"<default>"};
scanf("%d",&n);
getchar();
for(i=1;i<=n;i++)
{
gets(str);
biaoji=0;
len=strlen(str);
printf("URL #%d\n",no++);
p=str;
printf("Protocol = ");
for(;*p!=':';p++)
putchar(*p);
p=p+3;
printf("\n");
printf("Host = ");
for(;*p!=':'&&*p!='/'&&*p!='\0';p++)
putchar(*p);
if(*p==':')
{biaoji=1;p=p+1;}
printf("\n");
printf("Port = ");
if(biaoji==1)
{for(;*p!='/'&&*p!='\0';p++)
putchar(*p);printf("\n");}
else
printf("%s\n",information);
if(*p=='/')
{biaoji=1;p=p+1;}
printf("Path = ");
if(*p=='\0')
printf("%s",information);
else
{for(;*p!='\0';p++)
putchar(*p);}<
4000
span style="white-space:pre;">
printf("\n\n");
}
return 0;
}
#include<string.h>
int main()
{
int n,no=1,i,j,len,biaoji;
char str[80],*p;
char information[]={"<default>"};
scanf("%d",&n);
getchar();
for(i=1;i<=n;i++)
{
gets(str);
biaoji=0;
len=strlen(str);
printf("URL #%d\n",no++);
p=str;
printf("Protocol = ");
for(;*p!=':';p++)
putchar(*p);
p=p+3;
printf("\n");
printf("Host = ");
for(;*p!=':'&&*p!='/'&&*p!='\0';p++)
putchar(*p);
if(*p==':')
{biaoji=1;p=p+1;}
printf("\n");
printf("Port = ");
if(biaoji==1)
{for(;*p!='/'&&*p!='\0';p++)
putchar(*p);printf("\n");}
else
printf("%s\n",information);
if(*p=='/')
{biaoji=1;p=p+1;}
printf("Path = ");
if(*p=='\0')
printf("%s",information);
else
{for(;*p!='\0';p++)
putchar(*p);}<
4000
span style="white-space:pre;">
printf("\n\n");
}
return 0;
}
相关文章推荐
- ZOJ 1243 URLs
- ZOJ 1243 URLs
- ZOJ 1243 URLs
- ZOJ 1243 URLs
- zoj 1243 URLs
- zoj 1243 URLs
- ZOJ 1243 URLs
- ZOJ Problem Set - 1243 URLs
- HDU 1243 URLs
- ZOJ-1243
- zoj 1243
- ZOJ-1243(parse URL)
- ZOJ 1243
- zoj_1243
- zoj 3203 Light Bulb(三分)
- ZOJ-1060
- ZOJ - 3124 Celebrity jeopardy
- ZOJ 1148 The Game(bfs)
- ZOJ 1708||hdu 1035 Robot Motion (链式前向星,dfs)
- ZOJ 1203 Swordfish (经典MST ~ Kruscal)Boruvka算法