售货员的难题(0411)Time limit(ms): 5000Memory limit(kb): 65535Submission: 1744Accepted: 200Description某乡有n个村庄(1#include #include using namespace std;#define ...
分类:
其他好文 时间:
2014-11-19 07:19:31
阅读次数:
492
Given two numbers represented as strings, return multiplication of the numbers as a string.
Note: The numbers can be arbitrarily large and are non-negative.
原题链接:https://oj.leetcode.com/problems...
分类:
其他好文 时间:
2014-11-19 01:52:17
阅读次数:
141
Given an array of strings, return all groups of strings that are anagrams.
Note: All inputs will be in lower-case.
原题链接:https://oj.leetcode.com/problems/anagrams/
易位构词游戏的英文词汇是 anagram,这个词来源于有...
分类:
其他好文 时间:
2014-11-19 01:23:03
阅读次数:
136
Implement pow(x, n).
原题链接:https://oj.leetcode.com/problems/powx-n/
public double pow(double x, int n) {
if(n== 0)
return 1;
if(n == 1)
return x;
if(n % 2 ==0)
return pow(x*x,n/2);
...
分类:
其他好文 时间:
2014-11-19 01:19:41
阅读次数:
157
注意一个坑,就是当M是偶数的时候可能有两个M >> 1的值,这种时候就只能数数了.. 1 #include 2 #include 3 #include 4 #include 5 6 using namespace std; 7 8 #define OJ 9 10 #ifdef OJ11 ...
分类:
其他好文 时间:
2014-11-17 00:22:38
阅读次数:
296
原题链接:https://oj.leetcode.com/problems/lru-cache/
题目大意:设计操作系统中资源管理算法所使用的一种数据结构,即LRU算法。是一道偏向于综合的题。
方法:一个哈希表+一个双端链表
思路:一方面LRU Cache算法要求可以快速访问结点,所以我们很容易想到使用哈希表或者数组。另一方面,该算法要求在达到容量上限时,删除最久未访问的数据结点。这要求所设...
分类:
系统相关 时间:
2014-11-16 17:24:44
阅读次数:
182
西南科技大学ACM解题报告姓名:张艺童学号:5120142109组号:3班级:软件14021 题目来源:OJ 06152 题目描述:Description输出[m,n]间的所有素数,并且每5个换行,如果区间内不存在素数,输出0InputOutputSample Input13 17Sample Ou...
分类:
其他好文 时间:
2014-11-15 23:08:57
阅读次数:
424
西南科技大学ACM解题报告姓名:张艺童学号:5120142109组号:3班级:软件14021 题目来源:OJ 06162 题目描述:Description:用选择法对N个学生的成绩按从大到小的顺序排序,N个学生的成绩整数用scanf 输入,输入的成绩在[0,100]之间。排序完成后,输入一个成绩,要...
分类:
编程语言 时间:
2014-11-15 23:03:59
阅读次数:
429
简单dp,有O(n)做法,这里O(n^2)水过 1 #include 2 #include 3 #include 4 #include 5 6 using namespace std; 7 8 #define OJ 9 10 #ifdef OJ11 #define fin cin12 #...
分类:
其他好文 时间:
2014-11-14 22:27:11
阅读次数:
263