hackerrank--- challenges/fp-update-list
纯属为了练习haskell, 竟然贴代码都没办法高亮。
Update the values of a list with their absolute values. The input and output portions will be handled automatically during grading. You only need to write a function with the recommended method signature.
Input Format
There are N integers, each on a new line. These are the N elements of the input array.Output Format
N integers each on a new line; these are the absolute values of the input list, in that order.Sample Input
2
-4
3
-1
23
-4
-54
Sample Output
2
4
3
1
23
4
54
Accpeted Code:
-- Enter your code here. Read input from STDIN. Print output to STDOUT f arr = [if x >= 0 then x else -x | x <- arr] -- Complete this function here -- This section handles the Input/Output and can be used as it is. Do not modify it.
main = do
inputdata <- getContents
mapM_ putStrLn $ map show $ f $ map (read :: String -> Int) $ lines inputdata
hackerrank--- challenges/fp-update-list的更多相关文章
- 对openflow 1.0协议的扩展
通过这几天对openvswitch代码的分析,以及项目的须要,须要对openflow 1.0进行一定的扩展,发现网上没有这方面的教程,尽管在搞懂ovs代码架构,floodlight controlle ...
- Alsa 读取wave文件,并播放wave 文件
对于一个wave文件,如果需要播放,涉及到几个方面 1.对于wave文件的解析 2.通过解析wave文件,将得到的参数(主要是sampfrequency, bitsperSample,channel) ...
- scrapy-redis 分布式爬虫
为什么要学? Scrapy_redis在scrapy的基础上实现了更多,更强大的功能. 有哪些功能体现? request去重.爬虫持久化.实现分布式爬虫.断点续爬(带爬取的request存在redis ...
- 【原创】qlogic网卡软中断不均衡问题分析
引子 使用qlogic QL45000网卡测试业务性能,发现cpu软中断分布不均衡,而且很有规律,导致cpu空闲也不是很均衡, 会影响业务稳定性. 设备使用3张网卡Qlogic网卡,配置为4*25G模 ...
- scrapy入门与进阶
Scrapy是用纯Python实现一个为了爬取网站数据.提取结构性数据而编写的应用框架,用途非常广泛. 框架的力量,用户只需要定制开发几个模块就可以轻松的实现一个爬虫,用来抓取网页内容以及各种图片,非 ...
- Scrapy基础02
一.start_requests def start_requests(self): cls = self.__class__ if method_is_overridden(cls, Spider, ...
- scrapy-redis(一)
安装scrapy-redis pip install scrapy-redis 从GitHub 上拷贝源码: clone github scrapy-redis源码文件 git clone https ...
- scrapy爬虫系列之七--scrapy_redis的使用
功能点:如何发送携带cookie访问登录后的页面,如何发送post请求登录 简单介绍: 安装:pip3 install scrapy_redis 在scrapy的基础上实现了更多的功能:如reques ...
- Scrapy 增量式爬虫
Scrapy 增量式爬虫 https://blog.csdn.net/mygodit/article/details/83931009 https://blog.csdn.net/mygodit/ar ...
- 笔记-scrapy-去重
笔记-scrapy-去重 1. scrapy 去重 scrapy 版本:1.5.0 第一步是要找到去重的代码,scrapy在请求入列前去重,具体源码在scheduler.py: def en ...
随机推荐
- Python实现单神经元分类图片的训练
1.加载包和数据 numpy is the fundamental package for scientific computing with Python. h5py is a common pac ...
- go 交叉编译扩展 ac68u 梅林固件, go 依赖 zoneinfo 的解决问题
CGO_ENABLED= GOOS=linux GOARCH=arm GOARM= go build ddns.go r8500 虽然是 ARMv7 , 但应该是被阉割过,不支持 ARMv7 的一些特 ...
- java.sql.SQLIntegrityConstraintViolationException: Cannot add or update a child row: a foreign key constraint fails
HTTP Status 500 - Request processing failed; nested exception is org.hibernate.exception.ConstraintV ...
- 使用powerDesigner绘制类图
使用powerDesigner绘制类图 因为后面要理清楚spring中类与类之间关系,我们来看看如何使用powerDesigner绘制类图 你要去下载powerDesiger,一路下一步安装好 打开, ...
- Hadoop 伪分布式安装配置
- Hadoop 单机安装配置
- 解决JSP调用JavaBean出现乱码问题
解决JSP调用JavaBean出现乱码问题 话不多说放代码 144 Normal 0 7.8 磅 0 2 false false false EN-US ZH-CN X-NONE /* Style D ...
- uwsgi: invalid option -- 'x'
安装:pip install uwsgi 启动:uwsgi -x 'uwsgi.xml'报错:uwsgi: invalid option -- 'x' 原因:centos下,在没有安装libxml2时 ...
- mysql8忘记密码的解决方法
mysql8忘记密码的解决方法 1.管理员身份打开cmd,进入dos 2.停止mysql服务 命令:net stop mysql 3.无密码启动 命令:mysqld --console --skip- ...
- 洛谷P1966 [NOIP2013提高组Day1T2]火柴排队
P1966 火柴排队 题目描述 涵涵有两盒火柴,每盒装有 n 根火柴,每根火柴都有一个高度. 现在将每盒中的火柴各自排成一列, 同一列火柴的高度互不相同, 两列火柴之间的距离定义为: ∑(ai-bi) ...