HDU1088_Write a simple HTML Browser

FPGA实战:AXI BRAM Controller配置避坑指南(Vivado 2023版) 本文详细解析了Vivado 2023环境下AXI BRAM Controller的配置技巧与避坑指南,涵盖AXI4协议转换、BRAM地址空间配置、信号异常处理及突发传输优化等核心内容。针对写时序冲突、跨时钟域处理等常见问题提供实用解决方案,帮助开发者提升FPGA系统性能与稳定性。 阅读详情

Write a simple HTML Browser

http://acm.hdu.edu.cn/showproblem.php?pid=1088

Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others)

Total Submission(s): 11461    Accepted Submission(s): 3255


Problem Description
If you ever tried to read a html document on a Macintosh, you know how hard it is if no Netscape is installed. 
Now, who can forget to install a HTML browser? This is very easy because most of the times you don't need one on a MAC because there is a Acrobate Reader which is native to MAC. But if you ever need one, what do you do? 
Your task is to write a small html-browser. It should only display the content of the input-file and knows only the html commands (tags) <br> which is a linebreak and <hr> which is a horizontal ruler. Then you should treat all tabulators, spaces and newlines as one space and display the resulting text with no more than 80 characters on a line.
 

Input
The input consists of a text you should display. This text consists of words and HTML tags separated by one or more spaces, tabulators or newlines. 
A word is a sequence of letters, numbers and punctuation. For example, "abc,123" is one word, but "abc, 123" are two words, namely "abc," and "123". A word is always shorter than 81 characters and does not contain any '<' or '>'. All HTML tags are either <br> or <hr>.
 

Output
You should display the the resulting text using this rules: 
  . If you read a word in the input and the resulting line does not get longer than 80 chars, print it, else print it on a new line. 
  . If you read a <br> in the input, start a new line. 
  . If you read a <hr> in the input, start a new line unless you already are at the beginning of a line, display 80 characters of '-' and start a new line (again). 
The last line is ended by a newline character.
 

Sample Input
  
Hallo, dies ist eine ziemlich lange Zeile, die in Html aber nicht umgebrochen wird. <br> Zwei <br> <br> produzieren zwei Newlines. Es gibt auch noch das tag <hr> was einen Trenner darstellt. Zwei <hr> <hr> produzieren zwei Horizontal Rulers. Achtung mehrere Leerzeichen irritieren Html genauso wenig wie mehrere Leerzeilen.
 

Sample Output
  
Hallo, dies ist eine ziemlich lange Zeile, die in Html aber nicht umgebrochen wird. Zwei produzieren zwei Newlines. Es gibt auch noch das tag -------------------------------------------------------------------------------- was einen Trenner darstellt. Zwei -------------------------------------------------------------------------------- -------------------------------------------------------------------------------- produzieren zwei Horizontal Rulers. Achtung mehrere Leerzeichen irritieren Html genauso wenig wie mehrere Leerzeilen.
 

Source

#include <stdio.h>  
#include <string.h>  
int main()
{
	char str[10000][85];
	int i = 0, l = 0, k = 0, tmp = 0, len = 0;

	i = 0;
	while (scanf("%s", str[i]) != EOF)   i++;
	k = i;

	len = 0;
	for (i = 0;i<k;i++)
	{
		tmp = strlen(str[i]);
		if (strcmp(str[i], "<hr>") == 0)
		{
			if (len)	printf("\n");
			for (l = 0;l<80;l++)    printf("-");
			printf("\n");
			len = 0;
		}
		else if (strcmp(str[i], "<br>") == 0)
		{
			printf("\n");
			len = 0;
		}
		else
		{
			if (len + 1 + tmp>80)
			{
				len = tmp;
				printf("\n%s", str[i]);
			}
			else if (len)
			{
				printf(" %s", str[i]);
				len += tmp + 1;
			}
			else
			{
				printf("%s", str[i]);
				len = tmp;
			}
		}
	}
	printf("\n");
	return 0;
}
【Unity3D优化】优化内置shader的内存占用 在打AB包的过程中,并不会把这些Built-in的shader单独打包,并与材质球和预设体做好依赖,因此打AB包时,Unity会自行在材质球和预制体的AB包内每一个都包含进去用到的Built-in的Shader,而且运行时,由于加载的是不同的AB包,shader也是不同的实例,占用的也是多份内存。结合项目特点可以分析,由于项目里使用了大量的粒子特效,一些特殊的效果,会给特效师写定制的shader,但是这些常见的效果,特效师直接使用了Unity Built-in的shader。继续优化内存占用。 阅读详情

相关推荐

ubuntu18.04安装R——无法连接上 dl.google.com:80 (6.6.6.6),连接超时&&E: 无法修正错误,因为您要求某些软件包保持现状,就是它们破坏了软件包间的依赖关系。

安装R的时候,sudo apt update 的时候出现错误: 查资料要修改/etc/apt/sources.list.d/google-chrome.list 文件 原来是: deb http://dl.google.com/linux/chrome/deb/ stable main 改为: deb [arch=amd64] http://dl.google.com/linux/chrom...

许希律的博客 4354

Write a simple HTML Browser(1088)

Write a simple HTML Browser(1088)

cwl353253492的专栏 626

机器人控制入门

机器人控制入门 对于工科领域来说,脱离实践的学习都是肤浅的,对于控制这种强调经验的技术更是如此。如果去问一个程序员怎么学习一块技术,他必然让你去多编程。机器人领域也是。如果想把基本功打扎实,那么实践更是必不可少了。 机器人控制有三个元素:控制器(算法),执行器(电机),传感器; 控制的本质就是将规划系统的指令作为输入信息,将传感器探测得到的状态信息和导航系统的定位

彼岸花 1万+

HDU1088:Write a simple HTML Browser

Problem Description If you ever tried to read a html document on a Macintosh, you know how hard it is if no Netscape is installed.  Now, who can forget to install a HTML browser? This is very easy b

ACM!荣耀之路! 3335

XGBoost的简单安装及入门使用

XGBoost安装及简单入门 XGBoost支持多种操作系统,如Windows, Linux, MacOS等,并支持多种语言版本,如Python, R, Scale, Java等。XGBoost的安装方式一般有两种,一种是直接通过pip安装(适合用于Python),另外一种是通过源码编译安装 1、通过pip安装 通过pip安装Python包既简单又方便,只需执行如下的命令: pip install -i https://pypi.tuna.tsinghua.edu.cn/simple xgboost 使用

qq_41513230的博客 3万+

手把手教你用Matlab/Simulink搭建PMSM的SMO无感FOC仿真(附相位补偿与离散化代码)

本文详细介绍了基于滑模观测器(SMO)的永磁同步电机(PMSM)无传感器FOC控制方法,通过Matlab/Simulink平台实现从理论到实践的完整流程。内容涵盖SMO核心原理、离散化处理、转子位置估算与相位补偿技术,以及双闭环控制系统搭建,为工程师提供了一套完整的无传感器控制解决方案。

weixin_27038245的博客 256

网页信息抓取利器HTMLParser的使用

声明:转载自http://www.cnblogs.com/loveyakamoz/archive/2011/07/27/2118937.html HTMLParser具有小巧,快速的优点,缺点是相关文档比较少(英文的也少),很多功能需要自己摸索。对于初学者还是要费一些功夫的,而一旦上手以后,会发现HTMLParser的结构设计很巧妙,非常实用,基本你的各种需求都可以满足。     这里我根据自

w_y_loong的专栏 1300

如何使用3D高斯分布进行环境建模

使用3D高斯分布来进行建模,关键在于通过引入不确定性描述来提高建图的鲁棒性和精度。与传统点云表示相比,3D高斯分布提供了一种更为灵活和有效的方式来处理空间数据,能够通过协方差矩阵表示点的空间不确定性,帮助优化SLAM过程中的定位和地图更新。

JaydenQ的博客 2357

HDU - 1088 Write a simple HTML Browser

HDU - 1088 Write a simple HTML Browser 传送门 问题描述: If you ever tried toread a html document on a Macintosh, you know how hard it is if no Netscape is installed. Now, who can forget to install a HTML browser? This is very easy because most of the times you d

m0_51727949的博客 190

windchill安装搭建(保姆式)

保姆式搭建windchill 材料准备 Vmware工具,用来创建和打开虚拟机的工具 安装系统的镜像文件 数据库安装文件,这里是Oracle数据库 Windchill的安装包 Vmware工具,用来安装和打开虚拟机的软件 Windowsserver2008的镜像工具,用来安装虚拟机环境的系统,如果你有win2007或win2010的也可以,在做虚拟机时,需要先安装系统。 Oracle数据库安装包 Windchill11M030的安装包 (安装包如有需要可以私信邮箱发送) 虚拟机安装 安装虚拟机VMware

tr1294937662的博客 6219

CDD数据库文件制作(二)——DTC配置

1.DTC库 2.新建DTC DTC相关介绍:https://blog.youkuaiyun.com/LOVE135149/article/details/122565443 ① 选择DTC数据库 ② 点击新建DTC ③ DTC参数编辑 3.将DTC库中的DTC加载到Variant中 找到Fault Memory的DTC Table,鼠标放在DTC Table区域,右键点击选择Copy … Reference from Available DTCs…,即可将DTC库中的故障码加载至Variant中。 虽然选择Co

LOVE135149的博客 1万+

HDU1086——You can Solve a Geometry Problem too,HDU1087——Super Jumping! Jumping! Jumping!,HDU1088

用于接收输入的整数,表示数字的个数。来存储输入的数字,通过一个循环读取。来表示线段,包含两个端点的坐标。个数字开始,对于每个数字。,并定义了一个同长度的。,即能得到的最大结果。

u014114223的博客 198

关闭搜狗输入法右下角广告的解决方案

本文主要介绍了关闭搜狗输入法右下角广告的解决方案,希望能对使用搜狗输入法的同学们有所帮助。 文章目录 1. 问题描述 2. 解决方案

weixin_43178406的博客 1万+

HDU 1088 Write a simple HTML Browser

Problem DescriptionIf you ever tried to read a html document on a Macintosh, you know how hard it is if no Netscape is installed. Now, who can forget to install a HTML browser? This is very easy beca

贾作真时真亦贾的博客 435

Statistics and Machine Learning Toolbox

Statistics and Machine Learning Toolbox(带书签),MATLAB统计学习工具

Probability and Statistics - 4th edition

Probability and Statistics - 4th edition

hdu-1088 Write a simple HTML Browser

Write a simple HTML Browser Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others) Total Submission(s): 10513    Accepted Submission(s): 3030 Problem Description

oYinGui1 605

复分析 阿尔福斯(Ahlfors) 第三版答案 英文

答案分为十章,有部分习题没有答案,全英文复分析阿尔福斯(Ahlfors) 第三版答案

hdu 1088 Write a simple HTML Browser

hdu  1088  Write a simple HTML Browser                        题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1088 字符串处理小水题 题目大意:写一个会按照HTML语法规则处理输入并输出的程序 题目分析:要点有三。      (1)80个字符一行,一个单词不可断成两截,所以超了的

slicer的技术交流栈 972

Devexpress16.2.6破解工具

Devexpress16.2.6破解工具Devexpress16.2.6破解工具Devexpress16.2.6破解工具Devexpress16.2.6破解工具

hdu1088 Write a simple HTML Browser

题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1088 #include #include int main() { int i,count=0;//count一行内已经输出的字符个数 char word[82]; while(scanf("%s",word)!=EOF) { if(strcmp(word,"")==0

不可不戒 798

HDU 1088 Write a simple HTML Browser

HDU 1088 Write a simple HTML Browser 水题,就是会各种PE坑爹、、、不多说 #include #include char word[81]; int main() { int len, i; int cc = -1; while(scanf("%s", word)==1) { if(strcmp(word, "")==0) {

Remilia's 806

Write a simple HTML Browser(HDU-1088)

由于html的语法特性,多个连续的空白字符会被一个空格代替,如此一个单词一个单词地读取就行了 #include<cstdio> #include<cstring> int main() { char str[90]; int leng=0; while(scanf("%s",str)!=EOF) { if(strcmp(st...

qq_40634175的博客 602

HDU 1088 Write a simple HTML Browser

题目地址: http://acm.hdu.edu.cn/showproblem.php?pid=1088   简单模拟,多注意细节就行了。   代码如下:有注释 #include #include #include #include #include #include #include #include #include #include #include #i

lamborghini1993 906

HDU1088 Write a simple HTML Browser【文本处理】

Write a simple HTML Browser Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others) Total Submission(s): 18656 Accepted Submission(s): 5410 Problem Description If you ever tried to read a html document on a Macintosh, you kno

海岛Blog 422

Hdu 1088 - Write a simple HTML Browser

最近在学html5,而且也在做字符串的题,所以挑了Hdu 1088 来做。 顺便推荐一个学习web,html的网址:http://www.w3school.com.cn   题目分析:注意每个单词之间有空格,但是每行最后一个单词后没有空格。 AC代码: #include #include int main() { char str[11111][85]; int len; in

Chuck的博客 932

【字符串】HDU1088Write a simple HTML Browser

题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1088 #include using namespace std; int main() { // freopen("test.txt","r",stdin); string s; string ans=""; int len=0; while(cin>>s){

wlxsq的专栏 375

hdu 1088 Write a simple HTML Browser

Problem Description If you ever tried to read a html document on a Macintosh, you know how hard it is if no Netscape is installed.  Now, who can forget to install a HTML browser? This is very easy

u013776243的专栏 429

hdu 1088 Write a simple HTML Browser 字符串处理

Problem Description If you ever tried to read a html document on a Macintosh, you know how hard it is if no Netscape is installed. Now, who can forget to install a HTML browser? This is very easy because most of the times you don't need one on a MAC becau

Lionel 883

HDU - 1088 Write a simple HTML Browser (模拟)

简单的模拟

什么样的小孩 的博客 239
上一篇: HDU1073_Online Judge
下一篇: HDU2004_成绩转换
ZayneHuang
博客等级 码龄10年 5粉丝 116原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

当前余额3.43元 前往充值 >
需支付:10.00元
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付元
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值