自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(259)
  • 资源 (11)
  • 问答 (1)
  • 收藏
  • 关注

原创 Android 开源项目源码分析第一期正式发布

由 Trinea 发起、几十名 Android 开发者参与的Android 开源项目源码分析第一期正式发布。 从简介、总体设计、流程图、详细设计全方面分析开源库源码,第一期包括 10 个著名开源库及 5 个公共技术点的全面介绍。 最终这个 Star 近 6000 的开源汇总项目会和分析项目结合起来,做到主要开源库都有对应源码解析! 分析文档 作者 Volley 源码解析

2015-02-10 01:03:34 2596 1

原创 Android 插件化 动态升级

最新内容请见原文:Android 插件化 动态升级不少朋友私信以及 Android开源交流几个 QQ 群 中都问到这个问题,这里简单介绍下1、作用大多数朋友开始接触这个问题是因为 App 爆棚了,方法数超过了一个 Dex 最大方法数 65535 的上限,从这个介绍中也知道可以通过多个 Dex 来解决这个问题,因而便有了插件化的概念,将一个 App 划分为多个

2014-09-19 08:08:32 1152

原创 Android 开源库获取途径整理

介绍目前收藏 Android 开源库比较多的 GitHub 项目、网站、Twitter、App 及如何获取最新的 Android 开源库。1. GitHubAndroid 开源项目汇总Android 优秀开源项目实现原理解析把这两个放在前面,是因为这两个项目我和一群小伙伴在精心维护,同时任何人都可以提交 PR 参与进来。其他网站或 App 都可以以此为数据源

2014-08-20 02:24:35 1600

原创 Android开源项目分类汇总

分类整理了150个比较好的Android开源项目,已汇总到AndroidOpenProject@Github,欢迎Star和Fork^_* 目前包括:Android开源项目第一篇——个性化控件(View)篇  包括ListView、ActionBar、Menu、ViewPager、Gallery、GridView、ImageView、ProgressBar等等And

2014-01-09 20:06:14 1561

原创 性能优化系列总篇

最新最准确内容建议直接访问原文:性能优化系列总篇本文为性能优化系列的总纲,主要介绍性能调优专题计划、何为性能问题、性能调优方式及前面介绍的数据库优化、布局优化、Java(Android)代码优化具体对应的调优方式。 1、调优专题博客计划目前调优专题已完成五部分:性能优化总纲——性能问题及性能调优方式性能优化第三篇——Java(Android)代码

2013-09-04 23:51:49 1054

原创 总结的一些android公共库

本文主要介绍自己在android开发中总结的一些公共库,目前包括下拉刷新ListView、可以响应各个方向CompoundDrawables点击操作的TextView、图片缓存、图片SD卡缓存、图片工具类,不断更新,欢迎交流公共库代码地址:AndroidCommon@GoogleCode或AndroidCommon@Git对应Demo地址:Demo@GoogleCode或Demo@

2012-07-16 17:40:22 1664

原创 Java Android 注解(Annotation) 及几个常用开源项目注解原理简析

不少开源库都用到了注解的方式来简化代码提高开发效率。本文简单介绍下 Annotation 示例、概念及作用、分类、自定义、解析,并对几个 Android 开源库 Annotation 原理进行简析。PDF 版: Java Annotation.pdf, PPT 版:Java Annotation.pptx, Keynote 版:Java Annotation.key

2014-10-17 08:26:30 1135

原创 Java Android 注解(Annotation) 及几个常用开源项目注解原理简析

不少开源库(ButterKnife、Retrofit、ActiveAndroid等等)都用到了注解的方式来简化代码提高开发效率。 本文简单介绍下 Annotation 示例、概念及作用、分类、自定义、解析,并对几个 Android 开源库 Annotation 原理进行简析。PDF 版: Java Annotation.pdf, PPT 版:Java Annotation.pptx, Ke...

2014-10-17 08:23:54 317

原创 Android 插件化 动态升级

最新内容请见原文:Android 插件化 动态升级 不少朋友私信以及 Android开源交流几个 QQ 群 中都问到这个问题,这里简单介绍下1、作用大多数朋友开始接触这个问题是因为 App 爆棚了,方法数超过了一个 Dex 最大方法数 65535 的上限,从这个介绍中也知道可以通过多个 Dex 来解决这个问题,因而便有了插件化的概念,将一个 App 划分为多个插件(Dex或相关格...

2014-09-19 08:06:27 219

原创 Java ClassLoader基础及加载不同依赖 Jar 中的公共类

 转载自:最新内容及最清晰格式请见 http://www.trinea.cn/android/java-loader-common-class/ 本文主要介绍 ClassLoader 的基础知识,ClassLoader 如何动态加载 Jar,ClassLoader 隔离问题及如何加载不同 Jar 中的公共类。 本文工程开源地址见:Java Dynamic Load Jar@G...

2014-09-02 01:09:39 212

原创 Java ClassLoader基础及加载不同依赖 Jar 中的公共类

最新内容及最清晰格式请见:http://www.trinea.cn/android/java-loader-common-class/本文主要介绍 ClassLoader 的基础知识,ClassLoader 如何动态加载 Jar,ClassLoader 隔离问题及如何加载不同 Jar 中的公共类。 本文工程开源地址见:Java Dynamic Load Jar@

2014-09-02 01:09:23 1236

Android 开源库获取途径整理

最新内容请见原文: http://www.trinea.cn/android/android-open-project-summary/ 介绍目前收藏 Android 开源库比较多的 GitHub 项目、网站、Twitter、App 及如何获取最新的 Android 开源库。1. GitHubAndroid 开源项目汇总Android 优秀开源项目实现原理解析把这两个放在前面,...

2014-08-20 02:14:10 222

原创 Android Java执行Shell命令

[b]最新内容建议直接访问原文:[/b][url]http://www.trinea.cn/android/android-java-execute-shell-commands/[/url]主要介绍Android或Java应用中如何以默认用户或root用户执行Shell命令,ShellUtils的API介绍、使用及使用场景(如静默安装和卸载、修改hosts文件、拷贝文件)。使用纯Ja...

2014-02-28 00:41:16 247

原创 Android开源项目分类汇总

分类整理了150个比较好的Android开源项目,已汇总到AndroidOpenProject@Github,欢迎Star和Fork^_* 目前包括:Android开源项目第一篇——个性化控件(View)篇  包括ListView、ActionBar、Menu、ViewPager、Gallery、GridView、ImageView、ProgressBar等等Android开源项目第...

2014-01-09 08:18:34 147

原创 ArrayList和LinkedList的几种循环遍历方式及性能对比分析

最新最准确内容建议直接访问原文:ArrayList和LinkedList的几种循环遍历方式及性能对比分析 主要介绍ArrayList和LinkedList这两种list的五种循环遍历方式,各种方式的性能测试对比,根据ArrayList和LinkedList的源码实现分析性能结果,总结结论。通过本文你可以了解(1)List的五种遍历方式及各自性能 (2)foreach及Itera

2013-10-31 13:06:14 1336

原创 ArrayList和LinkedList的几种循环遍历方式及性能对比分析

最新最准确内容建议直接访问原文:ArrayList和LinkedList的几种循环遍历方式及性能对比分析 主要介绍ArrayList和LinkedList这两种list的五种循环遍历方式,各种方式的性能测试对比,根据ArrayList和LinkedList的源码实现分析性能结果,总结结论。通过本文你可以了解(1)List的五种遍历方式及各自性能 (2)foreach及Iterator的...

2013-10-31 13:02:32 213

原创 Android利用Fiddler进行网络数据抓包

最新最准确内容建议直接访问原文:Android利用Fiddler进行网络数据抓包主要介绍Android及IPhone手机上如何进行网络数据抓包,比如我们想抓某个应用(微博、微信、墨迹天气)的网络通信请求就可以利用这个方法。相对于tcpdump配合wireshark抓包的优势在于:(1)无需root (2)对Android和Iphone同样适用 (3)操作更简单方便(第一

2013-10-21 21:31:43 2125 1

原创 Android常用的工具类

最新最准确内容建议直接访问原文:Android常用的工具类主要介绍总结的Android开发中常用的工具类,大部分同样适用于Java。目前包括HttpUtils、DownloadManagerPro、ShellUtils、PackageUtils、PreferencesUtils、JSONUtils、FileUtils、ResourceUtils、StringUtils、

2013-10-12 09:26:45 1007

原创 Android常用的工具类

最新最准确内容建议直接访问原文:Android常用的工具类 主要介绍总结的Android开发中常用的工具类,大部分同样适用于Java。目前包括HttpUtils、DownloadManagerPro、ShellUtils、PackageUtils、PreferencesUtils、JSONUtils、FileUtils、ResourceUtils、StringUtils、ParcelU...

2013-10-12 09:09:40 183

原创 单例模式的标准写法、注意事项、作用及测试

最新最准确内容建议直接访问原文:单例模式 主要介绍单例模式的标准写法、注意事项、作用、测试,以Java语言为例,下面代码是目前见过最好的写法:public class Singleton { private static volatile Singleton instance = null; // private constructor suppres...

2013-09-09 20:57:30 185

原创 性能优化系列总篇

最新最准确内容建议直接访问原文:性能优化系列总篇 本文为性能优化系列的总纲,主要介绍性能调优专题计划、何为性能问题、性能调优方式及前面介绍的数据库优化、布局优化、Java(Android)代码优化具体对应的调优方式。 1、调优专题博客计划目前调优专题已完成五部分:性能优化总纲——性能问题及性能调优方式性能优化第三篇——Java(Android)代码优化性能优化第二篇——布局...

2013-09-04 23:46:06 237

原创 性能优化之Java(Android)代码优化

最新最准确内容建议直接访问原文:性能优化之Java(Android)代码优化 本文为Android性能优化的第三篇——Java(Android)代码优化。主要介绍Java代码中性能优化方式及网络优化,包括缓存、异步、延迟、数据存储、算法、JNI、逻辑等优化方式。(时间仓促,后面还会继续完善^_*) 性能优化专题已完成五部分:性能优化总纲——性能问题及性能调优

2013-08-26 20:46:15 1054

原创 性能优化之Java(Android)代码优化

最新最准确内容建议直接访问原文:性能优化之Java(Android)代码优化 本文为Android性能优化的第三篇——Java(Android)代码优化。主要介绍Java代码中性能优化方式及网络优化,包括缓存、异步、延迟、数据存储、算法、JNI、逻辑等优化方式。(时间仓促,后面还会继续完善^_*) 性能优化专题已完成五部分:性能优化总纲——性能问题及性能调优方式性能优化第三篇...

2013-08-26 20:45:57 112

原创 滚动到底部加载更多及下拉刷新listview的使用

最新内容建议直接访问原文:滚动到底部加载更多及下拉刷新listview的使用 本文主要介绍可同时实现下拉刷新及滑动到底部加载更多的ListView的使用。该ListView优点包括:a. 可自定义下拉响应事件(如下拉刷新)  b.可自定义滚动到底部响应的事件(如滑动到底部加载更多)  c.可自定义丰富的样式  d.高效(若下拉样式关闭不会加载其布局,同listView效率一

2013-08-21 21:37:31 1916

原创 Android ListView滑动过程中图片显示重复错乱闪烁问题解决

最新内容建议直接访问原文:Android ListView滑动过程中图片显示重复错乱闪烁问题解决 主要分析Android ListView滚动过程中图片显示重复、错乱、闪烁的原因及解决方法,顺带提及ListView的缓存机制。1、原因分析ListView item缓存机制:为了使得性能更优,ListView会缓存行item(某行对应的View)。ListView通过ad

2013-08-21 21:31:37 1639

原创 Android性能优化之布局优化

最新最准确内容建议直接访问原文:Android性能优化之布局优化本文为Android性能优化的第二篇——布局优化,主要介绍使用抽象布局标签(include, viewstub, merge)、去除不必要的嵌套和View节点、减少不必要的infalte及其他Layout方面可调优点,顺带提及布局调优相关工具(hierarchy viewer和lint)。性能优化专题已完成五部分:

2013-08-21 21:30:18 1214

原创 性能优化之数据库优化

最新最准确内容建议直接访问原文:性能优化之数据库优化本文为性能优化的第一篇——数据库性能优化,原理适用于大部分数据库包括Sqlite、Mysql、Oracle、Sql server,详细介绍了索引(优缺点、分类、场景、规则)和事务,最后介绍了部分单独针对Sqlite的优化。 性能优化专题已完成五部分:性能优化总纲——性能问题及性能调优方式性能优化第三篇——Jav

2013-08-21 21:29:35 1036

原创 Android性能优化之数据库优化

最新最准确内容建议直接访问原文:性能优化之数据库优化本文为性能优化的第一篇——数据库性能优化,原理适用于大部分数据库包括Sqlite、Mysql、Oracle、Sql server,详细介绍了索引(优缺点、分类、场景、规则)和事务,最后介绍了部分单独针对Sqlite的优化。 性能优化专题已完成五部分:性能优化总纲——性能问题及性能调优方式性能优化第三篇——Java(Android...

2013-08-21 21:15:23 164

原创 Android性能优化之布局优化

最新最准确内容建议直接访问原文:Android性能优化之布局优化本文为Android性能优化的第二篇——布局优化,主要介绍使用抽象布局标签(include, viewstub, merge)、去除不必要的嵌套和View节点、减少不必要的infalte及其他Layout方面可调优点,顺带提及布局调优相关工具(hierarchy viewer和lint)。1、抽象布局标签(1) <inc...

2013-08-13 20:20:50 232

原创 Android ListView滑动过程中图片显示重复错乱闪烁问题解决

最新内容建议直接访问原文:Android ListView滑动过程中图片显示重复错乱闪烁问题解决 主要分析Android ListView滚动过程中图片显示重复、错乱、闪烁的原因及解决方法,顺带提及ListView的缓存机制。1、原因分析ListView item缓存机制:为了使得性能更优,ListView会缓存行item(某行对应的View)。ListView通过adapter的...

2013-08-07 22:24:45 329

滚动到底部加载更多及下拉刷新listview的使用

最新内容建议直接访问原文:滚动到底部加载更多及下拉刷新listview的使用 本文主要介绍可同时实现下拉刷新及滑动到底部加载更多的ListView的使用。 该ListView优点包括:a. 可自定义下拉响应事件(如下拉刷新)  b.可自定义滚动到底部响应的事件(如滑动到底部加载更多)  c.可自定义丰富的样式  d.高效(若下拉样式关闭不会加载其布局,同listView效率一致...

2013-06-24 21:11:07 167

原创 滚动到底部或顶部响应的ScrollView使用

建议直接访问原文:滚动到底部或顶部响应的ScrollView使用本文介绍滚动到底部或顶部响应(如加载更多)的ScrollView的使用。关于实现原理可见:滑动到底部或顶部响应的ScrollView实现本文可运行代码地址可见BorderScrollViewDemo,可运行APK地址TrineaAndroidDemo.apk。效果图如下:BorderScrollView继承自ScrollView,...

2013-05-31 13:02:02 169

原创 Android系统下载管理DownloadManager功能介绍及使用示例

建议直接访问原文:Android系统下载管理DownloadManager功能介绍及使用示例本文主要结合源码介绍Android系统下载管理DownloadManager的强大功能及使用。这是许久来准备写的一系列博客,这篇主要介绍DownloadManager的功能和示例,后面还有两篇会介绍下载管理的底层设计(DownloadProvider、DownloadManager、DownloadMa...

2013-05-23 13:03:08 255

原创 Sqlite插入或更新

在数据库中我们经常会有这种需求,[b]插入时,某条记录不存在则插入,存在则更新。或更新时,某条记录存在则更新,不存在则插入[/b]。比如:人员信息数据库,某个身份证若已经存在,重复插入则更新,否则新增记录。网页缓存数据库,某个url已经存在,重复插入则更新,否则新增记录。 在mysql中可以使用replace into或是insert into …. on duplicate ke...

2013-05-15 09:20:44 214

原创 android.os.BadParcelableException: ClassNotFoundException when unmarshalling

应用打开,home键到后台,一段时间打开,偶现fc android.os.BadParcelableException: ClassNotFoundException when unmarshalling。具体原因原因、解决方法及android的class loader介绍见[url=http://www.trinea.cn/android/android-os-badparcelable...

2013-05-08 12:55:42 300

原创 viewpager实现画廊(一屏多个Fragment)效果

最新内容建议直接访问原文:viewpager实现画廊(一屏多个Fragment)效果 本文主要介绍如何利用ViewPager实现Gallery的画廊效果,即一屏显示多个Fragment。在使用Gallery的时候大家会发现有几个问题(1). 无法控制每次滑动只滑动一页, (2). Gallery默认第一个item居中,无法修改它与Gallery的左间距。ViewPager可以方便的解决...

2013-04-08 09:15:19 318

Android性能调优工具TraceView介绍

本文主要介绍Android性能调优工具TraceView的使用及通过其确定性能点。Android自带的TraceView可以方便的查看线程的执行情况,某个方法执行时间、调用次数、在总体中的占比等,从而定位性能点。1、生成日志,运行TraceView运行TraceView有两种方式a、调用Debug类,b、使用DDMs 2、TraceView界面信息介绍(1) 时间面板...

2013-04-01 08:56:10 147

Android应用如何开机自启动、自启动失败原因

Android应用如何实现开机自启动? 开机自启动失败的原因有哪些? 应用是否可以在安装后自启动呢? 没有ui界面的纯service应用能够自启动吗? adb命令能发送广播模拟开机启动吗? 看看上面这些疑惑的答案吧*_@ Android应用如何开机自启动、自启动失败原因 ...

2013-03-26 09:15:40 223

Android APK反编译查看源码及资源文件

想学习下其他Apk的源码吗?想看看其他Apk的图片资源、布局文件、清单文件吗?想把别人的Apk稍作修改后重新打包试试效果吗?那就看看如何利用dex2jar和apktool反编译Android应用程序查看源代码、资源文件和xml文件以及修改后重新打包成APK把,别做坏事哦  ...

2013-03-20 09:09:49 217

Android性能调优

本文主要分享自己在appstore项目中的性能调优点.包括同步改异步、减少对象创建(缓存)、Layout优化、数据库优化、算法优化、延迟执行等。解决界面滑动明显卡顿,Activity跳转慢,网络获取慢等性能问题,具体见 Android那些可调优点 ^_^  ...

2013-03-11 21:26:49 120

IEProxy IE代理

IE代理 免费代理 代理服务器 快速的代理 上网代理 浏览器免费代理 代理服务器地址列表 代理服务器软件 代理IP 代理在线 Internet Explorer 免费代理 免费代理服务器 免费代理服务器地址 免费代理软件 代理IP 代理服务器设置 通过此软件可以方便的设置IE代理,并且可以搜索网上免费的代理服务器 1.应用代理 联网搜索可用代理,用户可以通过选择列表框中的某个代理后单击应用代理或直接双击列表框中的某一行设置代理 2.联网刷新 联网搜索可用代理,显示在列表框中。对于用户保存的代理会显示在列表最上方 联网刷新会与实际的网速相关,可能需要几秒至几十秒。若网速过慢,请耐心等待。 3.开启/关闭代理 软件开始运行时可自动检测是否已经使用代理,若已使用,则按钮为关闭代理。若没有使用代理,则显示开启代理。在设置代理后会在两种状态中切换 4.软件设置 快捷键为F12 4.1可以设置软件开机自启动 4.2使用某个代理后可以自动测试代理是否可用。此选项与测试的代理速度有关,当代理不可用或速度过慢的时候可能需要几十秒,一般几秒即可。可以在右方按提示输入测试网址。默认为www.baidu.com 4.3对于使用锐捷认证的用户可以选择启动后启动锐捷,不过需要选择锐捷的安装目录。O(∩_∩)O~其实可以在这里选择任意软件跟随IEProxy启动,这要选择了正确的路径,不过不要选择本软件的地址,否则会进入死循环,桌面蹦出几十个IEProxy窗口(*^__^*) 嘻嘻…… 4.4自动判断锐捷获得IP是否正确,由于时间关系,暂时没有完成 4.5软件更新,可联系到作者csdn主页,下载最新版 5.增加新代理 输入代理地址和端口,并进行相应选择后,新增代理。可以选择长久保存代理复选框。也可以通过点击清空保存按钮清空保存的所有的代理。 6.软件相关 快捷键为F1 可以查看软件更新内容和作者的相关信息 软件相关信息 花两天多一点的时间写出来的一个小的搜寻代理程序,有点粗糙,会继续更新 只不过这一段时间会比较忙,软件更新暂时到此为止,除了设置对话框中屏蔽掉的一个功能,最初规划的功能还有一些没实现,界面也没怎么弄,两个月后接着更新,谢谢关注!有比较好的建议欢迎留言或Email ver 4.0 Beta 1.增加软件设置功能具体设置有: 1.1开机自启动 1.2选择代理后自动判断是否可用 1.3开机后自启动锐捷 1.4启动锐捷后判断IP是否正确 1.5软件更新 2.更改设置界面Tab键的顺序 3.更改主界面Tab键的顺序 4.修改设置界面中static控件覆盖 5.增加对F1键到相关的响应 6.增加对F2键到设置响应 7.完善了控件对回车的响应,包括设置 Dialog和about Dialog中的控件 8.修改设置后判断代理是否可用提示错误 9.增加密码编辑框Password属性 10.修改置顶复选框的问题 11.修改连续刷新造成的代理重复问题 12.增加了测试网站不用输入类型的功能,增加了输入提示,连接失败提示框加入测试网址可能错误的提示 13.完善了右击托盘图标的设置功能 ver 3.0 Beta 1.增加初始化时显示上次的代理列表功能 2.完善长期保存功能 3.增加清空保存功能 4.增加初始化时读取保存的代理功能 5.修改置顶功能在重置时的错误响应 6.修改static控件覆盖 ver 2.3 Beta 1.增加了所有控件对回车键的响应 2.增加置顶功能 3.更改所有控件Tab顺序 4.修改了按钮内容提示不太准确问题 ver 2.2 Beta 1.增减双击直接设置功能 2.增加最小化到托盘功能 3.修改关于信息 ver 2.0 Beta 1.增加动态更新功能 2.增加 手动增加代理功能 3.更换图标 4.去掉数据库存储 下载地址:http://download.csdn.net/user/Lethe1989 个人主页:http://hi.csdn.net/link.php?url=http://blog.csdn.net%2Fl:[email protected] 欢迎提供建议,谢谢O(∩_∩)O~

2009-09-19

poj 1061 青蛙的约会

因为源代码和解题报告暂时还有用,只上传了测试用例, 用的是扩展欧几里德算法 可是参考网址http://blog.csdn.net/Fioman/archive/2008/05/18/2455698.aspx 上的算法 青蛙的约会 Time Limit: 1000MS Memory Limit: 10000K Total Submissions: 36755 Accepted: 4913 Description 两只青蛙在网上相识了,它们聊得很开心,于是觉得很有必要见一面。它们很高兴地发现它们住在同一条纬度线上,于是它们约定各自朝西跳,直到碰面为止。可是它们出发之前忘记了一件很重要的事情,既没有问清楚对方的特征,也没有约定见面的具体位置。不过青蛙们都是很乐观的,它们觉得只要一直朝着某个方向跳下去,总能碰到对方的。但是除非这两只青蛙在同一时间跳到同一点上,不然是永远都不可能碰面的。为了帮助这两只乐观的青蛙,你被要求写一个程序来判断这两只青蛙是否能够碰面,会在什么时候碰面。 我们把这两只青蛙分别叫做青蛙A和青蛙B,并且规定纬度线上东经0度处为原点,由东往西为正方向,单位长度1米,这样我们就得到了一条首尾相接的数轴。设青蛙A的出发点坐标是x,青蛙B的出发点坐标是y。青蛙A一次能跳m米,青蛙B一次能跳n米,两只青蛙跳一次所花费的时间相同。纬度线总长L米。现在要你求出它们跳了几次以后才会碰面。 Input 输入只包括一行5个整数x,y,m,n,L,其中x≠y < 2000000000,0 < m、n < 2000000000,0 < L < 2100000000。 Output 输出碰面所需要的跳跃次数,如果永远不可能碰面则输出一行"Impossible" Sample Input 1 2 3 4 5 Sample Output 4 Source 浙江

2009-06-01

poj 1007 DNA Sorting

DNA Sorting Time Limit: 1000MS Memory Limit: 10000K Total Submissions: 34868 Accepted: 13480 Description One measure of ``unsortedness'' in a sequence is the number of pairs of entries that are out of order with respect to each other. For instance, in the letter sequence ``DAABEC'', this measure is 5, since D is greater than four letters to its right and E is greater than one letter to its right. This measure is called the number of inversions in the sequence. The sequence ``AACEDGG'' has only one inversion (E and D)---it is nearly sorted---while the sequence ``ZWQM'' has 6 inversions (it is as unsorted as can be---exactly the reverse of sorted). You are responsible for cataloguing a sequence of DNA strings (sequences containing only the four letters A, C, G, and T). However, you want to catalog them, not in alphabetical order, but rather in order of ``sortedness'', from ``most sorted'' to ``least sorted''. All the strings are of the same length. Input The first line contains two integers: a positive integer n (0 < n <= 50) giving the length of the strings; and a positive integer m (0 < m <= 100) giving the number of strings. These are followed by m lines, each containing a string of length n. Output Output the list of input strings, arranged from ``most sorted'' to ``least sorted''. Since two strings can be equally sorted, then output them according to the orginal order. Sample Input 10 6 AACATGAAGG TTTTGGCCAA TTTGGCCAAA GATCAGATTT CCCGGGGGGA ATCGATGCAT Sample Output CCCGGGGGGA AACATGAAGG GATCAGATTT ATCGATGCAT TTTTGGCCAA TTTGGCCAAA Source East Central North America 1998

2009-06-01

poj 1006 Biorhythms 生理周期

Biorhythms Time Limit: 1000MS Memory Limit: 10000K Total Submissions: 53539 Accepted: 15282 Description Some people believe that there are three cycles in a person's life that start the day he or she is born. These three cycles are the physical, emotional, and intellectual cycles, and they have periods of lengths 23, 28, and 33 days, respectively. There is one peak in each period of a cycle. At the peak of a cycle, a person performs at his or her best in the corresponding field (physical, emotional or mental). For example, if it is the mental curve, thought processes will be sharper and concentration will be easier. Since the three cycles have different periods, the peaks of the three cycles generally occur at different times. We would like to determine when a triple peak occurs (the peaks of all three cycles occur in the same day) for any person. For each cycle, you will be given the number of days from the beginning of the current year at which one of its peaks (not necessarily the first) occurs. You will also be given a date expressed as the number of days from the beginning of the current year. You task is to determine the number of days from the given date to the next triple peak. The given date is not counted. For example, if the given date is 10 and the next triple peak occurs on day 12, the answer is 2, not 3. If a triple peak occurs on the given date, you should give the number of days to the next occurrence of a triple peak. Input You will be given a number of cases. The input for each case consists of one line of four integers p, e, i, and d. The values p, e, and i are the number of days from the beginning of the current year at which the physical, emotional, and intellectual cycles peak, respectively. The value d is the given date and may be smaller than any of p, e, or i. All values are non-negative and at most 365, and you may assume that a triple peak will occur within 21252 days of the given date. The end of input is indicated by a line in which p = e = i = d = -1. Output For each test case, print the case number followed by a message indicating the number of days to the next triple peak, in the form: Case 1: the next triple peak occurs in 1234 days. Use the plural form ``days'' even if the answer is 1. Sample Input 0 0 0 0 0 0 0 100 5 20 34 325 4 5 6 7 283 102 23 320 203 301 203 40 -1 -1 -1 -1 Sample Output Case 1: the next triple peak occurs in 21252 days. Case 2: the next triple peak occurs in 21152 days. Case 3: the next triple peak occurs in 19575 days. Case 4: the next triple peak occurs in 16994 days. Case 5: the next triple peak occurs in 8910 days. Case 6: the next triple peak occurs in 10789 days. Source East Central North America 1999 生理周期 Time Limit: 1000MS Memory Limit: 10000K Total Submissions: 53539 Accepted: 15282 Description 人生来就有三个生理周期,分别为体力、感情和智力周期,它们的周期长度为23天、28天和33天。每一个周期中有一天是高峰。在高峰这天,人会在相应的方面表现出色。例如,智力周期的高峰,人会思维敏捷,精力容易高度集中。因为三个周期的周长不同,所以通常三个周期的高峰不会落在同一天。对于每个人,我们想知道何时三个高峰落在同一天。对于每个周期,我们会给出从当前年份的第一天开始,到出现高峰的天数(不一定是第一次高峰出现的时间)。你的任务是给定一个从当年第一天开始数的天数,输出从给定时间开始(不包括给定时间)下一次三个高峰落在同一天的时间(距给定时间的天数)。例如:给定时间为10,下次出现三个高峰同天的时间是12,则输出2(注意这里不是3)。 Input 输入四个整数:p, e, i和d。 p, e, i分别表示体力、情感和智力高峰出现的时间(时间从当年的第一天开始计算)。d 是给定的时间,可能小于p, e, 或 i。 所有给定时间是非负的并且小于365, 所求的时间小于21252。 当p = e = i = d = -1时,输入数据结束。 Output 从给定时间起,下一次三个高峰同天的时间(距离给定时间的天数)。 采用以下格式: Case 1: the next triple peak occurs in 1234 days. 注意:即使结果是1天,也使用复数形式“days”。 Sample Input 0 0 0 0 0 0 0 100 5 20 34 325 4 5 6 7 283 102 23 320 203 301 203 40 -1 -1 -1 -1 Sample Output Case 1: the next triple peak occurs in 21252 days. Case 2: the next triple peak occurs in 21152 days. Case 3: the next triple peak occurs in 19575 days. Case 4: the next triple peak occurs in 16994 days. Case 5: the next triple peak occurs in 8910 days. Case 6: the next triple peak occurs in 10789 days. Source East Central North America 1999 Translator 北京大学程序设计实习2007, Xie Di

2009-06-01

poj 1005 I Think I Need a Houseboat

I Think I Need a Houseboat Time Limit: 1000MS Memory Limit: 10000K Total Submissions: 41126 Accepted: 16537 Description Fred Mapper is considering purchasing some land in Louisiana to build his house on. In the process of investigating the land, he learned that the state of Louisiana is actually shrinking by 50 square miles each year, due to erosion caused by the Mississippi River. Since Fred is hoping to live in this house the rest of his life, he needs to know if his land is going to be lost to erosion. After doing more research, Fred has learned that the land that is being lost forms a semicircle. This semicircle is part of a circle centered at (0,0), with the line that bisects the circle being the X axis. Locations below the X axis are in the water. The semicircle has an area of 0 at the beginning of year 1. (Semicircle illustrated in the Figure.) Input The first line of input will be a positive integer indicating how many data sets will be included (N). Each of the next N lines will contain the X and Y Cartesian coordinates of the land Fred is considering. These will be floating point numbers measured in miles. The Y coordinate will be non-negative. (0,0) will not be given. Output For each data set, a single line of output should appear. This line should take the form of: “Property N: This property will begin eroding in year Z.” Where N is the data set (counting from 1), and Z is the first year (start from 1) this property will be within the semicircle AT THE END OF YEAR Z. Z must be an integer. After the last data set, this should print out “END OF OUTPUT.” Sample Input 2 1.0 1.0 25.0 0.0 Sample Output Property 1: This property will begin eroding in year 1. Property 2: This property will begin eroding in year 20. END OF OUTPUT. Hint 1.No property will appear exactly on the semicircle boundary: it will either be inside or outside. 2.This problem will be judged automatically. Your answer must match exactly, including the capitalization, punctuation, and white-space. This includes the periods at the ends of the lines. 3.All locations are given in miles. Source Mid-Atlantic 2001

2009-06-01

poj 1004 Financial Management

Financial Management Time Limit: 1000MS Memory Limit: 10000K Total Submissions: 49263 Accepted: 23921 Description Larry graduated this year and finally has a job. He's making a lot of money, but somehow never seems to have enough. Larry has decided that he needs to grab hold of his financial portfolio and solve his financing problems. The first step is to figure out what's been going on with his money. Larry has his bank account statements and wants to see how much money he has. Help Larry by writing a program to take his closing balance from each of the past twelve months and calculate his average account balance. Input The input will be twelve lines. Each line will contain the closing balance of his bank account for a particular month. Each number will be positive and displayed to the penny. No dollar sign will be included. Output The output will be a single number, the average (mean) of the closing balances for the twelve months. It will be rounded to the nearest penny, preceded immediately by a dollar sign, and followed by the end-of-line. There will be no other spaces or characters in the output. Sample Input 100.00 489.12 12454.12 1234.10 823.05 109.20 5.27 1542.25 839.18 83.99 1295.01 1.75 Sample Output $1581.42 Source Mid-Atlantic 2001

2009-06-01

poj 1003 Hangover

Hangover Time Limit: 1000MS Memory Limit: 10000K Total Submissions: 44187 Accepted: 20574 Description How far can you make a stack of cards overhang a table? If you have one card, you can create a maximum overhang of half a card length. (We're assuming that the cards must be perpendicular to the table.) With two cards you can make the top card overhang the bottom one by half a card length, and the bottom one overhang the table by a third of a card length, for a total maximum overhang of 1/2 + 1/3 = 5/6 card lengths. In general you can make n cards overhang by 1/2 + 1/3 + 1/4 + ... + 1/(n + 1) card lengths, where the top card overhangs the second by 1/2, the second overhangs tha third by 1/3, the third overhangs the fourth by 1/4, etc., and the bottom card overhangs the table by 1/(n + 1). This is illustrated in the figure below. Input The input consists of one or more test cases, followed by a line containing the number 0.00 that signals the end of the input. Each test case is a single line containing a positive floating-point number c whose value is at least 0.01 and at most 5.20; c will contain exactly three digits. Output For each test case, output the minimum number of cards necessary to achieve an overhang of at least c card lengths. Use the exact output format shown in the examples. Sample Input 1.00 3.71 0.04 5.19 0.00 Sample Output 3 card(s) 61 card(s) 1 card(s) 273 card(s) Source Mid-Central USA 2001

2009-06-01

POJ 1002 487-3279 telephone numbers

487-3279 Time Limit: 2000MS Memory Limit: 65536K Total Submissions: 102808 Accepted: 17241 Description Businesses like to have memorable telephone numbers. One way to make a telephone number memorable is to have it spell a memorable word or phrase. For example, you can call the University of Waterloo by dialing the memorable TUT-GLOP. Sometimes only part of the number is used to spell a word. When you get back to your hotel tonight you can order a pizza from Gino's by dialing 310-GINO. Another way to make a telephone number memorable is to group the digits in a memorable way. You could order your pizza from Pizza Hut by calling their ``three tens'' number 3-10-10-10. The standard form of a telephone number is seven decimal digits with a hyphen between the third and fourth digits (e.g. 888-1200). The keypad of a phone supplies the mapping of letters to numbers, as follows: A, B, and C map to 2 D, E, and F map to 3 G, H, and I map to 4 J, K, and L map to 5 M, N, and O map to 6 P, R, and S map to 7 T, U, and V map to 8 W, X, and Y map to 9 There is no mapping for Q or Z. Hyphens are not dialed, and can be added and removed as necessary. The standard form of TUT-GLOP is 888-4567, the standard form of 310-GINO is 310-4466, and the standard form of 3-10-10-10 is 310-1010. Two telephone numbers are equivalent if they have the same standard form. (They dial the same number.) Your company is compiling a directory of telephone numbers from local businesses. As part of the quality control process you want to check that no two (or more) businesses in the directory have the same telephone number. Input The input will consist of one case. The first line of the input specifies the number of telephone numbers in the directory (up to 100,000) as a positive integer alone on the line. The remaining lines list the telephone numbers in the directory, with each number alone on a line. Each telephone number consists of a string composed of decimal digits, uppercase letters (excluding Q and Z) and hyphens. Exactly seven of the characters in the string will be digits or letters. Output Generate a line of output for each telephone number that appears more than once in any form. The line should give the telephone number in standard form, followed by a space, followed by the number of times the telephone number appears in the directory. Arrange the output lines by telephone number in ascending lexicographical order. If there are no duplicates in the input print the line: No duplicates. Sample Input 12 4873279 ITS-EASY 888-4567 3-10-10-10 888-GLOP TUT-GLOP 967-11-11 310-GINO F101010 888-1200 -4-8-7-3-2-7-9- 487-3279 Sample Output 310-1010 2 487-3279 4 888-4567 3 Source East Central North America 1999 487-3279 Time Limit: 2000MS Memory Limit: 65536K Total Submissions: 102808 Accepted: 17241 Description 企业喜欢用容易被记住的电话号码。让电话号码容易被记住的一个办法是将它写成一个容易记住的单词或者短语。例如,你需要给滑铁卢大学打电话时,可以拨打TUT-GLOP。有时,只将电话号码中部分数字拼写成单词。当你晚上回到酒店,可以通过拨打310-GINO来向Gino's订一份pizza。让电话号码容易被记住的另一个办法是以一种好记的方式对号码的数字进行分组。通过拨打必胜客的“三个十”号码3-10-10-10,你可以从他们那里订pizza。 电话号码的标准格式是七位十进制数,并在第三、第四位数字之间有一个连接符。电话拨号盘提供了从字母到数字的映射,映射关系如下: A, B, 和C 映射到 2 D, E, 和F 映射到 3 G, H, 和I 映射到 4 J, K, 和L 映射到 5 M, N, 和O 映射到 6 P, R, 和S 映射到 7 T, U, 和V 映射到 8 W, X, 和Y 映射到 9 Q和Z没有映射到任何数字,连字符不需要拨号,可以任意添加和删除。 TUT-GLOP的标准格式是888-4567,310-GINO的标准格式是310-4466,3-10-10-10的标准格式是310-1010。 如果两个号码有相同的标准格式,那么他们就是等同的(相同的拨号) 你的公司正在为本地的公司编写一个电话号码薄。作为质量控制的一部分,你想要检查是否有两个和多个公司拥有相同的电话号码。 Input 输入的格式是,第一行是一个正整数,指定电话号码薄中号码的数量(最多100000)。余下的每行是一个电话号码。每个电话号码由数字,大写字母(除了Q和Z)以及连接符组成。每个电话号码中只会刚好有7个数字或者字母。 Output 对于每个出现重复的号码产生一行输出,输出是号码的标准格式紧跟一个空格然后是它的重复次数。如果存在多个重复的号码,则按照号码的字典升序输出。如果输入数据中没有重复的号码,输出一行: No duplicates. Sample Input 12 4873279 ITS-EASY 888-4567 3-10-10-10 888-GLOP TUT-GLOP 967-11-11 310-GINO F101010 888-1200 -4-8-7-3-2-7-9- 487-3279 Sample Output 310-1010 2 487-3279 4 888-4567 3 Source East Central North America 1999 Translator 北京大学程序设计实习2007

2009-06-01

POJ 1008 Maya Calendar

Maya Calendar Time Limit: 1000MS Memory Limit: 10000K Total Submissions: 28541 Accepted: 8643 Description During his last sabbatical, professor M. A. Ya made a surprising discovery about the old Maya calendar. From an old knotted message, professor discovered that the Maya civilization used a 365 day long year, called Haab, which had 19 months. Each of the first 18 months was 20 days long, and the names of the months were pop, no, zip, zotz, tzec, xul, yoxkin, mol, chen, yax, zac, ceh, mac, kankin, muan, pax, koyab, cumhu. Instead of having names, the days of the months were denoted by numbers starting from 0 to 19. The last month of Haab was called uayet and had 5 days denoted by numbers 0, 1, 2, 3, 4. The Maya believed that this month was unlucky, the court of justice was not in session, the trade stopped, people did not even sweep the floor. For religious purposes, the Maya used another calendar in which the year was called Tzolkin (holly year). The year was divided into thirteen periods, each 20 days long. Each day was denoted by a pair consisting of a number and the name of the day. They used 20 names: imix, ik, akbal, kan, chicchan, cimi, manik, lamat, muluk, ok, chuen, eb, ben, ix, mem, cib, caban, eznab, canac, ahau and 13 numbers; both in cycles. Notice that each day has an unambiguous description. For example, at the beginning of the year the days were described as follows: 1 imix, 2 ik, 3 akbal, 4 kan, 5 chicchan, 6 cimi, 7 manik, 8 lamat, 9 muluk, 10 ok, 11 chuen, 12 eb, 13 ben, 1 ix, 2 mem, 3 cib, 4 caban, 5 eznab, 6 canac, 7 ahau, and again in the next period 8 imix, 9 ik, 10 akbal . . . Years (both Haab and Tzolkin) were denoted by numbers 0, 1, : : : , where the number 0 was the beginning of the world. Thus, the first day was: Haab: 0. pop 0 Tzolkin: 1 imix 0 Help professor M. A. Ya and write a program for him to convert the dates from the Haab calendar to the Tzolkin calendar. Input The date in Haab is given in the following format: NumberOfTheDay. Month Year The first line of the input file contains the number of the input dates in the file. The next n lines contain n dates in the Haab calendar format, each in separate line. The year is smaller then 5000. Output The date in Tzolkin should be in the following format: Number NameOfTheDay Year The first line of the output file contains the number of the output dates. In the next n lines, there are dates in the Tzolkin calendar format, in the order corresponding to the input dates. Sample Input 3 10. zac 0 0. pop 0 10. zac 1995 Sample Output 3 3 chuen 0 1 imix 0 9 cimi 2801

2009-04-04

poj 1001 Exponentiation

poj 1001 Exponentiation用字符串操作的

2008-11-12

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除