(最近水题刷的比较多,不过还是有些收获,所以还是做个记录比较好)
http://acm.hdu.edu.cn/showproblem.php?pid=1282
分析:
题目理解起来还是简单的,基本上有两种思路:1) 将int转为string来实现; 2)直接用int做(回文串判断,相加)
第二中思路比较直接,将一个数倒置得到新的数,然后判断是否是回文数...
分类:
其他好文 时间:
2014-05-05 13:26:07
阅读次数:
276
1.CPU根据中断码如何找到中断处理程序
要定位中断处理程序,就需要找到中断处理程序的段地址和偏移地址,如果根据中断码找到他们?这就引入中断向量表,CPU用8位的中断类型码通过中断向量表找到相应的中断处理程序的入口地址。
2.使用中断类型码找到中断向量,并用它设置CS和IP,这个操作是由CPU硬件自动完成的。这个过程成为中断过程:
(1)从中断信息中取得中断类型码
(2)标志寄存器的值入栈...
分类:
其他好文 时间:
2014-05-05 12:57:22
阅读次数:
318
void Merge(int A[],int p,int q,int r){
int i,j,k;
//计算子数组A[p..q]的元素个数
int n1 = q - p + 1;
//计算子数组A[q+1..r]元素个数
int n2 = r - q;
//创建子数组L,R
int* L = (int*)malloc(sizeof(int)*...
分类:
其他好文 时间:
2014-05-04 12:44:38
阅读次数:
384
代码:
#include
#include
#include
#include
using namespace std;
const int maxn=10003;
const int inf=0x7fffffff;
int num[maxn];
int n;
int main()
{
while(scanf("%d",&n)!=EOF&&n)...
分类:
其他好文 时间:
2014-05-04 12:39:16
阅读次数:
331
博客:存储系统研究
微博:http://weibo.com/u/2203007022
(1) C语言可变参数
我们可以从C语言的printf得出可变参数的作用,printf函数的原型如下:
int printf ( const char * format, ... );
通过使用可变个数参数,就是传入的参数个数是可变的,如printf需要根...
分类:
编程语言 时间:
2014-05-04 00:24:27
阅读次数:
442
//继承SQLiteOpenHelper类,
public class DictionaryOpenHelper extends SQLiteOpenHelper{
public static final String DABASENAME = "dictionary";
private static final int DATABASE_VERSION = 1;
pri...
分类:
移动开发 时间:
2014-05-03 23:49:30
阅读次数:
589
list1 = [ 4, 7, 7, 3, 3, 3, 2, 1 ]
list2 = [ 5, 4, 3, 3, 2, 2, 2, 1, 1, 1 ]
def havel_hakimi_algo( degree_list ):
degree_list.sort( reverse = True )
print degree_list
for degr...
分类:
编程语言 时间:
2014-05-03 17:13:49
阅读次数:
426
计算诸如-123,456,789 + 123,123的值
import java.math.BigInteger;
import java.util.Scanner;
public class Main{
public static void main(String[] args){
Scanner cin = new Scanner(System.in);
String st...
分类:
编程语言 时间:
2014-05-03 16:50:55
阅读次数:
307
typedef不常见但值得一提的用途:
1. 用typedef来定义与平台无关的类型。
比如定义一个叫 REAL 的浮点类型,在目标平台一上,让它表示最高精度的类型为:
typedef long double REAL;
在不支持 long double 的平台二上,改为:
typedef double REAL;
在连 double 都不支持的平台三上,改为:
typedef ...
分类:
其他好文 时间:
2014-05-03 16:12:35
阅读次数:
289
package com.recursion;
import java.io.File;
public class RecursionFile {
public static void main(String[] args) {
File file = new File("G:/A");
tree(file, 0);
}
private static vo...
分类:
编程语言 时间:
2014-05-03 16:07:04
阅读次数:
265