现在位置: 首页 > devout发表的所有文章
  • 02月
  • 13日
综合 ⁄ 共 2241字 评论关闭
Description For any integer i>=3 we have F[i]=(F[i-1]+2*F[i-2]+3*F[i-3])%9901; Now give you F[0],F[1],F[2],can you tell me the value of F Input Fist Line, an integer Q(1<=Q<=100) represent the number of cases; Every case is a line of four integers:F[0],F[1],F[2],n; (0<=F[0],F[1],F[2]<9901,0<=n<100000000) Output For each case ,you are request to output one integer the value of F[n] in one line. Sample Input 4 1 2 3 3 4 5 6 5 2 3 4 2 4 5 6 100000 Sample Output ......
阅读全文
  • 05月
  • 24日
综合 ⁄ 共 2697字 评论关闭
  HandlerThread继承于Thread,所以它本质就是个Thread。与普通Thread的差别就在于,它有个Looper成员变量。这个Looper其实就是对消息队列以及队列处理逻辑的封装,简单说就是 消息队列+消息循环。 当我们需要一个工作者线程,而不是把它当作一次性消耗品,用过即废弃的话,就可以使用它。     private Handler mHandler = null;     private HandlerThread mHandlerThread = null;     private void sentRunnableToWorker(Runnable run){         if (null == mHandlerThread)         {             mHandlerThread = new Handl......
阅读全文
  • 05月
  • 03日
综合 ⁄ 共 1466字 评论关闭
1.一般用C语言节约空间,要用C++库函数或STL时才用C++;cout、cin和printf、scanf最好不要混用。 大数据输入输出时最好不要用cin、cout,防止超时。 2.有时候int型不够用,可以用long long或__int64型(两个下划线__)。 值类型表示值介于 -2^63 ( -9,223,372,036,854,775,808) 到2^63-1(+9,223,372,036,854,775,807 )之间的整数。 printf("%I64d",a); //__int64 一般VC编译器使用 printf("%lld",a); //long long 一般g++编译器使用 3.OJ判断是只看输出结果的。 所以大部分题处理一组数据后可以直接输出,就不需要用数组保存......
阅读全文
  • 02月
  • 22日
综合 ⁄ 共 1388字 评论关闭
文章目录 Problem Description Input Output Sample Input Sample Output Problem Description When playing DotA with god-like rivals and pig-like team members, you have to face an embarrassing situation: All your teammates are killed, and you have to fight 1vN. There are two key attributes for the heroes in the game, health point (HP) and damage per shot (DPS). Your hero has almost infinite HP, but only 1 DPS. To simplify the problem, we as......
阅读全文
  • 02月
  • 21日
综合 ⁄ 共 3222字 评论关闭
Get Many Persimmon Trees Time Limit: 1000MS   Memory Limit: 30000K Total Submissions: 3656   Accepted: 2378 Description Seiji Hayashi had been a professor of the Nisshinkan Samurai School in the domain of Aizu for a long time in the 18th century. In order to reward him for his meritorious career in education, Katanobu Matsudaira, the lord of the domain of Aizu, had decided to grant him a rectangular estate within a large field in the Aizu Basin. Although the size (width and hei......
阅读全文
  • 02月
  • 20日
综合 ⁄ 共 11313字 评论关闭
1 Overview   We can divide data structures into the following types: 2 General-purpose data structures   We call these general-purpose data structures because they are used to store and retrieve data using key values. This works for general-purpose database programs (as opposed to specialized structures such as stacks, which allow access to only certain data items). Which of these general-purpose data structures is appropriate for a given problem? Figure 15.1 shows a first approximation......
阅读全文
  • 02月
  • 08日
综合 ⁄ 共 5085字 评论关闭
一:背景 RecordReader表示以怎样的方式从分片中读取一条记录,每读取一条记录都会调用RecordReader类,系统默认的RecordReader是LineRecordReader,它是TextInputFormat对应的RecordReader;而SequenceFileInputFormat对应的RecordReader是SequenceFileRecordReader。LineRecordReader是每行的偏移量作为读入map的key,每行的内容作为读入map的value。很多时候hadoop内置的RecordReader并不能满足我们的需求,比如我们在读取记录的时候,希望Map读入的Key值不是偏移量而是行号或者是文件名,这时候就需要我们自定义RecordReader。......
阅读全文
  • 02月
  • 07日
综合 ⁄ 共 1338字 评论关闭
 问:员工曾经被追究过刑事责任的话,是否可以与其解除劳动合同?   答:根据《劳动法》第25条规定,劳动者被依法追究刑事责任的,用人单位可以解除劳动合同。劳动部办公厅在《关于〈劳动法〉若干条文的说明》(劳办发[1994]289号)中对此条款作了具体解。   刑事责任是指:1、被人民法院判处刑罚(包括主刑:管制、拘役、有期徒刑、无期徒刑、死刑;附加刑:罚金、剥夺政治权利、没收财产)的;2、被人民法院依据新《刑法》第37条免予刑事处罚的。   因此,劳动者被追究刑事责任,用人单位可以解除劳动合同。不过,用人......
阅读全文
  • 02月
  • 01日
综合 ⁄ 共 1672字 评论关闭
排序 Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others) Total Submission(s): 28373    Accepted Submission(s): 7854 Problem Description 输入一行数字,如果我们把这行数字中的‘5’都看成空格,那么就得到一行用空格分割的若干非负整数(可能有些整数以‘0’开头,这些头部的‘0’应该被忽略掉,除非这个整数就是由若干个‘0’组成的,这时这个整数就是0)。 你的任务是:对这些分割得到的整数,依从小到大的顺序排序输出。   Input 输入包含多组测试用例,每组输入数据只有一行数字(......
阅读全文
  • 01月
  • 24日
综合 ⁄ 共 1901字 评论关闭
使用UrlRewrite有三大好处:     一:提高安全性,可以有效的避免一些参数名、ID等完全暴露在用户面前,如果用户随便乱输的话,不符合规则的 话直接会返回个404或错误页面,这比直接返回500或一大堆服务器错误信息要好的多      二:美化URL,去除了那些比如*.do之类的后缀名、长长的参数串等,可以自己组织精简更能反映访问模块内容的URL     三:更有利于搜索引擎的收入,通过对URL的一些优化,可以使搜索引擎更好的识别与收录网站的信息           UrlRewrite的用法:     1. 首先下载jar包。从官网http://tuckey.org/urlrewri......
阅读全文
  • 01月
  • 19日
综合 ⁄ 共 742字 评论关闭
题目大意:有一块蛋糕,长为X,宽为Y,现在有n个人来分这块蛋糕,还要保证每个人分的蛋糕的面积相等。求一种分法,使得所有的蛋糕的长边与短边的比值的最大值最小。 思路:刚拿到这个题并没有什么思路。但是定睛一看,(n <= 10),额。。可以乱搞了。。。 直接爆搜就可以水过。传三个参数,代表当前的长和宽,还有当前块需要被分成几块,然后随便乱搞就可以水过了。。 CODE: #include <cstdio> #include <cstring> #include <iomanip> #include <iostream> #include <algorithm> using namespa......
阅读全文
  • 12月
  • 06日
综合 ⁄ 共 913字 评论关闭
 StackTraceElement[] el = Thread.currentThread().getStackTrace();      Map<Thread,StackTraceElement[]> map = Thread.getAllStackTraces();     System.out.println(map.size()+"^^^^^^^^^^^^^^");     for(StackTraceElement[] el2: map.values()){      for(int i =0; i<el2.length-1; i++){       System.out.println(el[i]+"^^^^^^^^^^^^^^^"+el[i].getMethodName());      }     }     System.out.println(el.length);     System.out.println(el[0]+"^^^^^^^^^^^^^^^"+el[0].getMethodName());        Syste......
阅读全文