08 2017 档案

摘要:昨天突然想在Android下调用图灵机器人API实现聊天的功能。说干就干,虽然过程中遇见一些问题,但最后解决了的心情真好。 API接口是(key值可以在图灵机器人网站里注册得到) 最后hello是讲的话,访问这个网站会访问一个JSON格式的内容。 text关键字就是访问的内容,只要把这个关键字的内容 阅读全文
posted @ 2017-08-29 10:58 starry_sky 阅读(1469) 评论(2) 推荐(0)
摘要:在Android中的四大组件中的广播接收者(BroadcastReceiver):可以用于监听 / 接收 应用发出的广播消息,并做出响应。 所以,通过这个自然而然的可以实现短信的拦截。 先定义一个SmsListenerRecevicer类来继承BroadcastReceiver。在里面实现短信的拦截 阅读全文
posted @ 2017-08-24 19:49 starry_sky 阅读(400) 评论(0) 推荐(0)
摘要:Problem Description Giving two strings and you should judge if they are matched.The first string contains lowercase letters and uppercase letters.The 阅读全文
posted @ 2017-08-22 22:04 starry_sky 阅读(333) 评论(0) 推荐(0)
摘要:多线程断点下载:顾名思义是用多线程实现的,断点是当第三方因素(断电、断网等)中断下载时,下次下载可以继续上次下载的地方下载。 1、通过getContentLength可以获取要下载文件的大小,这样可以在本机上创建一个相同大小的文件用来下载。 2、由于是多线程,所以要给每一个线程均分分配要下载的位置。 阅读全文
posted @ 2017-08-20 22:23 starry_sky 阅读(6755) 评论(13) 推荐(0)
摘要:A - Meal Delivery Time limit : 2sec / Memory limit : 256MB Score : 100 points Problem Statement Snuke lives at position x on a number line. On this li 阅读全文
posted @ 2017-08-20 21:09 starry_sky 阅读(440) 评论(0) 推荐(0)
摘要:A Secret Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 256000/256000 K (Java/Others)Total Submission(s): 0 Accepted Submission(s): 0 Problem De 阅读全文
posted @ 2017-08-19 18:35 starry_sky 阅读(330) 评论(0) 推荐(0)
摘要:CaoHaha's staff Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 0 Accepted Submission(s): 0 Probl 阅读全文
posted @ 2017-08-19 17:45 starry_sky 阅读(322) 评论(0) 推荐(0)
摘要:HttpClient的get方式: 由于是网络请求,一定要放在子线程里做。 首先创建一个HttpClient对象: 然后创建一个HttpGet,将url地址传进去: 然后获取状态码,200的话就是访问成功了: 接下来得到响应: 再判断内容是否登入成功就行了。 完整的方法: 1 public stat 阅读全文
posted @ 2017-08-19 12:00 starry_sky 阅读(3737) 评论(0) 推荐(0)
摘要:B. Godsend time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output Leha somehow found an array c 阅读全文
posted @ 2017-08-19 01:12 starry_sky 阅读(634) 评论(0) 推荐(0)
摘要:由于审核机制,所以一般在子线程里获取获取资源,然后在主线程里更新UI 网站源码是字符串,所以用创建一个类从输入流中获取字符串就行,图片是二进制的,就不能以获取字符串的形式,正好有BitmapFactory.decodeStream(inputStream); 可以从输入流中获取图片,返回Bitmap 阅读全文
posted @ 2017-08-18 16:14 starry_sky 阅读(940) 评论(0) 推荐(0)
摘要:ListView是一个可以在垂直滚动的列表中显示的一个控件,条目的内容来自一个ListAdapter。 由于ListAdapter是一个有很多参数的接口,所以直接去实现它就很麻烦,一般是直接去继承BaseAdapter类。 下面说正题。 在安卓应用中,一般的新闻展示可以用ListView控件来实现, 阅读全文
posted @ 2017-08-16 22:39 starry_sky 阅读(1359) 评论(0) 推荐(0)
摘要:A - Palindromic Number Problem Statement You are given a three-digit positive integer N. Determine whether N is a palindromic number. Here, a palindro 阅读全文
posted @ 2017-08-15 22:27 starry_sky 阅读(203) 评论(0) 推荐(0)
摘要:对sqlite数据库进行增删改查常用的有两种方法。 事务: 执行多条sql语句,要么同时执行成功,要么同时执行失败,不能有的成功,有的失败 第一种: 1.创建一个帮助类的对象,调用getReadableDatabase方法,返回一个SqliteDatebase对象 2.使用SqliteDatebas 阅读全文
posted @ 2017-08-15 20:16 starry_sky 阅读(888) 评论(0) 推荐(0)
摘要:在Android下用的数据库是:sqlite,嵌入式 轻量级的 创建sqlite数据库一般是去继承SQLiteOpenHelper类。 官方文档是这样的: 由于是一个抽象类就必须用一个类去继承它,里面有两个抽象方法onCreate和onUpgrade必须去实现。 onCreate方法:是数据库第一次 阅读全文
posted @ 2017-08-15 19:29 starry_sky 阅读(564) 评论(0) 推荐(0)
摘要:There are n cities and n - 1 roads in the Seven Kingdoms, each road connects two cities and we can reach any city from any other by the roads. Theon a 阅读全文
posted @ 2017-08-13 11:18 starry_sky 阅读(345) 评论(0) 推荐(0)
摘要:小C的倍数问题 Problem Description 根据小学数学的知识,我们知道一个正整数x是3的倍数的条件是x每一位加起来的和是3的倍数。反之,如果一个数每一位加起来是3的倍数,则这个数肯定是3的倍数。现在给定进制P,求有多少个B满足P进制下,一个正整数是B的倍数的充分必要条件是每一位加起来的 阅读全文
posted @ 2017-08-13 09:20 starry_sky 阅读(748) 评论(0) 推荐(0)
摘要:今天突然想写下关于在大一期间的一些事情,好方便以后回忆吧。 在填志愿的报考“网络工程”这个专业的时候,都是稀里糊涂的就报了。一开始第一专业是“软件工程”,第二专业时“计算机科学与技术”,第三专业才是“网络工程”。在填的时候听都没听过,只听过前两个,然后。。。就把网络工程改成第一专业了。可能是当时在百 阅读全文
posted @ 2017-08-12 13:13 starry_sky 阅读(414) 评论(0) 推荐(0)
摘要:It's well known that the best way to distract from something is to do one's favourite thing. Job is such a thing for Leha. So the hacker began to work 阅读全文
posted @ 2017-08-11 21:48 starry_sky 阅读(192) 评论(0) 推荐(0)
摘要:Erelong Leha was bored by calculating of the greatest common divisor of two factorials. Therefore he decided to solve some crosswords. It's well known 阅读全文
posted @ 2017-08-11 12:25 starry_sky 阅读(301) 评论(0) 推荐(0)
摘要:之前在Ubuntu下安装QQ时费了好久也只安装个国际版的QQ,今天无意间看到一个安装winqq的方法,可以安装新版QQ。 原地址http://www.jianshu.com/p/1150aa5a6cec 下面是效果展示: 话不多说,进入正题。 首先要安装win: sudo add-apt-repos 阅读全文
posted @ 2017-08-10 16:17 starry_sky 阅读(424) 评论(0) 推荐(0)
摘要:在Android中xml的生成有两种,其一是手工写入,其二是用XmlSerializer对象来生成。 比如要生成下面这中。 先创建一个SmsBean.java 类用来封装信息。 1 package cn.starry.xml.bean; 2 3 public class SmsBean { 4 pu 阅读全文
posted @ 2017-08-09 21:07 starry_sky 阅读(685) 评论(0) 推荐(0)
摘要:Pocket Cube Problem Description The Pocket Cube, also known as the Mini Cube or the Ice Cube, is the 2 × 2 × 2 equivalence of a Rubik’s Cube.The cube 阅读全文
posted @ 2017-08-09 19:33 starry_sky 阅读(323) 评论(0) 推荐(0)
摘要:斐波那契数列的定义如下: F(0) = 0 F(1) = 1 F(n) = F(n - 1) + F(n - 2) (n >= 2) (1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, 144, 233, 377, ...) 给出n,求F(n),由于结果很大,输出F(n) 阅读全文
posted @ 2017-08-09 10:43 starry_sky 阅读(212) 评论(0) 推荐(0)
摘要:给定一个十进制正整数N,写下从1开始,到N的所有正数,计算出其中出现所有1的个数。 例如:n = 12,包含了5个1。1,10,12共包含3个1,11包含2个1,总共5个1。 Input Output Input示例 Output示例 阅读全文
posted @ 2017-08-08 21:14 starry_sky 阅读(261) 评论(0) 推荐(0)
摘要:n的阶乘后面有多少个0? 6的阶乘 = 1*2*3*4*5*6 = 720,720后面有1个0。 Input Output Input示例 Output示例 阅读全文
posted @ 2017-08-08 19:46 starry_sky 阅读(204) 评论(0) 推荐(0)
摘要:一个高度为N的由正整数组成的三角形,从上走到下,求经过的数字和的最大值。 每次只能走到下一层相邻的数上,例如从第3层的6向下走,只能走到第4层的2或9上。 5 8 4 3 6 9 7 2 9 5 例子中的最优方案是:5 + 8 + 6 + 9 = 28 一个高度为N的由正整数组成的三角形,从上走到下 阅读全文
posted @ 2017-08-08 18:16 starry_sky 阅读(205) 评论(0) 推荐(0)
摘要:题目链接http://acm.hdu.edu.cn/showproblem.php?pid=6090 Problem Description As we know, Rikka is poor at math. Yuta is worrying about this situation, so he 阅读全文
posted @ 2017-08-08 17:57 starry_sky 阅读(167) 评论(0) 推荐(0)
摘要:Problem Description You are the hero who saved your country. As promised, the king will give you some cities of the country, and you can choose which 阅读全文
posted @ 2017-08-08 11:58 starry_sky 阅读(262) 评论(0) 推荐(0)
摘要:Problem Description 哗啦啦村袭击了喵哈哈村!度度熊为了拯救喵哈哈村,带着自己的伙伴去救援喵哈哈村去了!度度熊与伙伴们很快的就过来占据了喵哈哈村的各个军事要地,牢牢的守住了喵哈哈村。但是度度熊发现,这是一场旷日持久的战斗,所以度度熊决定要以逸待劳,保存尽量多的体力,去迎战哗啦啦村的 阅读全文
posted @ 2017-08-07 21:27 starry_sky 阅读(777) 评论(1) 推荐(0)
摘要:Description Bessie, Farmer John's prize cow, has just won first place in a bovine beauty contest, earning the title 'Miss Cow World'. As a result, Bes 阅读全文
posted @ 2017-08-07 17:29 starry_sky 阅读(248) 评论(0) 推荐(0)
摘要:double EPS = 1e-10; double add(double a,double b) { if(abs(a+b) < EPS * (abs(a) + abs(b))) return 0; return a + b; } struct Point{ double x, y; Point(){} Point(double x, double y)... 阅读全文
posted @ 2017-08-07 16:29 starry_sky 阅读(155) 评论(0) 推荐(0)
摘要:Description A student named Round Square loved to play with cones. He would arrange cones with different base radii arbitrarily on the floor and would 阅读全文
posted @ 2017-08-07 16:01 starry_sky 阅读(220) 评论(0) 推荐(0)
摘要:Description In the game of Jack Straws, a number of plastic or wooden "straws" are dumped on the table and players try to remove them one-by-one witho 阅读全文
posted @ 2017-08-07 14:13 starry_sky 阅读(273) 评论(0) 推荐(0)
摘要:度度熊保护村庄 Accepts: 47 Submissions: 900 Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others) 度度熊保护村庄 Accepts: 47 Submissions: 阅读全文
posted @ 2017-08-07 09:26 starry_sky 阅读(1595) 评论(0) 推荐(0)
摘要:Problem Description Zeus 和 Prometheus 做了一个游戏,Prometheus 给 Zeus 一个集合,集合中包含了N个正整数,随后 Prometheus 将向 Zeus 发起M次询问,每次询问中包含一个正整数 S ,之后 Zeus 需要在集合当中找出一个正整数 K 阅读全文
posted @ 2017-08-06 18:03 starry_sky 阅读(228) 评论(0) 推荐(0)
摘要:很多时候我们需要服务器在某个时间段运行某个命令,比如执行某个脚本等。 这时我们就可以安装"crontabs"这个软件了。 在我的CentOS服务器上是默认安装了,没有安装的可以运行: vixie-cron软件包是cron的主程序; crontabs软件包是用来安装、卸装、或列举用来驱动 cron 守 阅读全文
posted @ 2017-08-06 16:13 starry_sky 阅读(318) 评论(0) 推荐(0)
摘要:Problem Description 有很多从磁盘读取数据的需求,包括顺序读取、随机读取。为了提高效率,需要人为安排磁盘读取。然而,在现实中,这种做法很复杂。我们考虑一个相对简单的场景。磁盘有许多轨道,每个轨道有许多扇区,用于存储数据。当我们想在特定扇区来读取数据时,磁头需要跳转到特定的轨道、具体 阅读全文
posted @ 2017-08-05 10:52 starry_sky 阅读(214) 评论(0) 推荐(0)
摘要:D. Round Subset Let's call the roundness of the number the number of zeros to which it ends. You have an array of n numbers. You need to choose a subs 阅读全文
posted @ 2017-08-04 20:53 starry_sky 阅读(318) 评论(0) 推荐(0)
摘要:Description 题目描述: 大家知道,给出正整数n,则1到n这n个数可以构成n!种排列,把这些排列按照从小到大的顺序(字典顺序)列出,如n=3时,列出1 2 3,1 3 2,2 1 3,2 3 1,3 1 2,3 2 1六个排列。 任务描述: 给出某个排列,求出这个排列的下k个排列,如果遇到 阅读全文
posted @ 2017-08-04 16:58 starry_sky 阅读(366) 评论(0) 推荐(0)
摘要:排列2 Time Limit: 1000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 8893 Accepted Submission(s): 3278 Problem Des 阅读全文
posted @ 2017-08-04 16:32 starry_sky 阅读(179) 评论(0) 推荐(0)
摘要:Ignatius and the Princess II Problem Description Now our hero finds the door to the BEelzebub feng5166. He opens the door and finds feng5166 is about 阅读全文
posted @ 2017-08-04 15:26 starry_sky 阅读(191) 评论(0) 推荐(0)
摘要:A. Text Volume You are given a text of single-space separated words, consisting of small and capital Latin letters. Volume of the word is number of ca 阅读全文
posted @ 2017-08-04 14:54 starry_sky 阅读(276) 评论(0) 推荐(0)
摘要:Python的输入数野生字符串,需要自己转型,常用的转型函数有: strip :将两端的空白字符去掉,返回str slipt :将字符串用空白字符分开,返回[str] map:把list里面的值映射到指定类型,返回[type] isspace:是否用空行组成 EOF用来抓异常 输出加','不换行 P 阅读全文
posted @ 2017-08-04 13:29 starry_sky 阅读(3583) 评论(0) 推荐(1)
摘要:A. Text Volume You are given a text of single-space separated words, consisting of small and capital Latin letters. Volume of the word is number of ca 阅读全文
posted @ 2017-08-04 11:43 starry_sky 阅读(358) 评论(0) 推荐(0)
摘要:题目大意:任意△ABC中F、D、E分别为三边的三等分点中点,将其分别与对应的顶点相连,得到一个新的△RPQ。 现在给出△ABC的坐标,求△RPQ的面积 解题思路:求出△ABC的面积三角形 ABC 的面积 可以证明:S△BPQ :S△ABC = 1 : 7 也可以用每个边用向量缩减三倍求三分点,然后求 阅读全文
posted @ 2017-08-03 18:14 starry_sky 阅读(345) 评论(0) 推荐(0)
摘要:给定n行m列个正方形,求可以组成多少个三角形。 如1×2,有18个。 总的点有N个,那个答案就是C(N,3),然后减去横向、竖向、斜向的三点共线的个数即可,斜线三点共线等价于所枚举的矩形的长宽成倍数关系,即gcd不为1。(这个想不懂,先放在这) 阅读全文
posted @ 2017-08-03 18:09 starry_sky 阅读(184) 评论(0) 推荐(0)
摘要:题意是给定一个字符串,求最少把它分成多少份,使的每一份都是回文串。 错了好多遍,最后发现是贪心思路出了问题,一开始求出dp[i][j],dp[i][j]表示第i个到第j个这段子串是否是回文串,求出来后,我直接从1开始遍历,每次求最右边的,这种贪心思路是有问题的。 赛后看了别人的才知道可以用动态规划, 阅读全文
posted @ 2017-08-03 18:02 starry_sky 阅读(234) 评论(0) 推荐(0)
摘要:A - The Trip, 2007 小包可以放在打包里,求最少的数量。 做法就是求出现相同数字最多的。 B - Partitioning by Palindromes 传送 C - Seek the Name, Seek the Fame The little cat is so famous, 阅读全文
posted @ 2017-08-03 17:56 starry_sky 阅读(149) 评论(0) 推荐(0)
摘要:Heavy Transportation Description Background Hugo Heavy is happy. After the breakdown of the Cargolifter project he can now expand business. But he nee 阅读全文
posted @ 2017-08-03 11:18 starry_sky 阅读(147) 评论(0) 推荐(0)
摘要:Frogger Description Freddy Frog is sitting on a stone in the middle of a lake. Suddenly he notices Fiona Frog who is sitting on another stone. He plan 阅读全文
posted @ 2017-08-03 10:01 starry_sky 阅读(190) 评论(0) 推荐(0)
摘要:Description Bessie is out in the field and wants to get back to the barn to get as much sleep as possible before Farmer John wakes her for the morning 阅读全文
posted @ 2017-08-02 21:02 starry_sky 阅读(140) 评论(0) 推荐(0)
摘要:还是畅通工程 Problem Description 某省调查乡村交通状况,得到的统计表中列出了任意两村庄间的距离。省政府“畅通工程”的目标是使全省任何两个村庄间都可以实现公路交通(但不一定有直接的公路相连,只要能间接通过公路可达即可),并要求铺设的公路总长度为最小。请计算最小的公路总长度。 Inp 阅读全文
posted @ 2017-08-02 20:25 starry_sky 阅读(167) 评论(0) 推荐(0)
摘要:Networking Description You are assigned to design network connections between certain points in a wide area. You are given a set of points in the area 阅读全文
posted @ 2017-08-02 20:02 starry_sky 阅读(219) 评论(0) 推荐(0)
摘要:Description The Head Elder of the tropical island of Lagrishan has a problem. A burst of foreign aid money was spent on extra roads between villages s 阅读全文
posted @ 2017-08-02 19:38 starry_sky 阅读(142) 评论(0) 推荐(0)
摘要:QS Network ZOJ Problem Set - 1586 Sunny Cup 2003 - Preliminary Round April 20th, 12:00 - 17:00 Problem E: QS Network In the planet w-503 of galaxy cgb 阅读全文
posted @ 2017-08-02 19:03 starry_sky 阅读(182) 评论(0) 推荐(0)
摘要:给出一个整数K和一个无序数组A,A的元素为N个互不相同的整数,找出数组A中所有和等于K的数对。例如K = 8,数组A:{-1,6,5,3,4,2,9,0,8},所有和等于8的数对包括(-1,9),(0,8),(2,6),(3,5)。 Input Output Input示例 Output示例 阅读全文
posted @ 2017-08-02 17:17 starry_sky 阅读(250) 评论(0) 推荐(0)
摘要:给出圆的圆心和半径,以及三角形的三个顶点,问圆同三角形是否相交。相交输出"Yes",否则输出"No"。(三角形的面积大于0)。 Input Output Input示例 Output示例 阅读全文
posted @ 2017-08-02 16:43 starry_sky 阅读(198) 评论(0) 推荐(0)
摘要:第二次世界大战时期,英国皇家空军从沦陷国征募了大量外籍飞行员。由皇家空军派出的每一架飞机都需要配备在航行技能和语言上能互相配合的2名飞行员,其中1名是英国飞行员,另1名是外籍飞行员。在众多的飞行员中,每一名外籍飞行员都可以与其他若干名英国飞行员很好地配合。如何选择配对飞行的飞行员才能使一次派出最多的 阅读全文
posted @ 2017-08-02 15:06 starry_sky 阅读(257) 评论(0) 推荐(0)
摘要:Marriage Match II Problem Description Presumably, you all have known the question of stable marriage match. A girl will choose a boy; it is similar as 阅读全文
posted @ 2017-08-02 14:37 starry_sky 阅读(200) 评论(0) 推荐(0)
摘要:打表可以找出规律就是求n^k。 阅读全文
posted @ 2017-08-02 10:41 starry_sky 阅读(194) 评论(0) 推荐(0)
摘要:D. Palindromic characteristics Palindromic characteristics of string s with length |s| is a sequence of |s| integers, where k-th number is the total n 阅读全文
posted @ 2017-08-01 21:06 starry_sky 阅读(227) 评论(0) 推荐(0)
摘要:Island Transport Problem Description In the vast waters far far away, there are many islands. People are living on the islands, and all the transport 阅读全文
posted @ 2017-08-01 20:15 starry_sky 阅读(338) 评论(0) 推荐(0)
摘要:Description Farmer John wants to set up a telephone line at his farm. Unfortunately, the phone company is uncooperative, so he needs to pay for some o 阅读全文
posted @ 2017-08-01 18:53 starry_sky 阅读(370) 评论(0) 推荐(0)
摘要:A - Fence Repair Farmer John wants to repair a small length of the fence around the pasture. He measures the fence and finds that he needs N (1 ≤ N ≤ 阅读全文
posted @ 2017-08-01 16:54 starry_sky 阅读(236) 评论(0) 推荐(0)
摘要:A. Key races A. Key races Two boys decided to compete in text typing on the site "Key races". During the competition, they have to type a text consist 阅读全文
posted @ 2017-08-01 11:13 starry_sky 阅读(267) 评论(0) 推荐(0)