shines的技术专栏

☆路漫漫其修远兮,吾将上下而求索☆

2008年04月04日

原创 [转]内存拷贝的优化方法

P4提供了MOVNTQ指令,使用WC(Write-combining)模式,跳过缓存直接写内存。因为我们的写内存操作是纯粹的写,写入的数据一定时间内根本不会被使用,无论使用WT还是WB模式,都会有冗余的缓存操作。阅读全文>

发表于 @ 2008年04月04日 02:43:00|评论(loading...)|举报|收藏

2006年03月08日

转载 SecretSum (code jam china round2 500分真题) (第二轮淘汰赛)

We can substitute each digit of a number with a unique letter from 'A' to 'Z'. This way we can write groups of numbers in a single representation. For example "ABA" can represent any of the following: 101, 151, 343, 767, 929. However, "ABA" cannot mean 555 because each letter must stand for a distinct digit. Furthermore, numbers cannot begin with 0 and thus 'A' cannot be replaced by 0. Given two such representations num1 and num2 and the result of their summation return the total number of p阅读全文>

发表于 @ 2006年03月08日 17:59:00|评论(loading...)|举报|收藏

转载 RecurringNumbers (code jam china 1000分真题) (第二轮淘汰赛)

A rational number is defined as a/b, where a and b are integers, and b is greater than 0. Furthermore, a rational number can be written as a decimal that has a group of digits that repeat indefinitely. A common method of writing groups of repeating digits is to place them inside parentheses like 2.85(23) = 2.852323 ... 23... Given a decimal representation of a rational number in decimalNumber, convert it to a fraction formatted as "numerator/denominator", where both numerator and denominator阅读全文>

发表于 @ 2006年03月08日 14:58:00|评论(loading...)|举报|收藏

转载 FactorialSystem (code jam china round2 300分真题) (第二轮淘汰赛)

In the factorial number system the value of the first digit (from the right) is 1!, the value of the second digit is 2!, ..., and the value of the n-th digit is n!. This means that any decimal number d can be written in this system as: anan-1...a2a1, where d = an * n! + an-1 * (n-1)! + ... + a2 * 2! + a1 * 1! and 0 阅读全文>

发表于 @ 2006年03月08日 14:32:00|评论(loading...)|举报|收藏

转载 google中国编程挑战赛资格赛真题 -- BusStops(250分)

BusStops Problem Statement ???? You are given a String[] cityMap representing the layout of a city. The city consists of blocks. The first element of cityMap represents the first row of blocks, etc. A 'B' character indicates a location where there is a bus stop. There will be exactly one 'X' character, indicating your location. All other characters will be '.'. You are also given an int walkingDistance, which is the maximum distance you are willing to walk to a bus stop. The distance should阅读全文>

发表于 @ 2006年03月08日 14:19:00|评论(loading...)|举报|收藏

转载 google中国编程挑战赛资格赛真题 -- PlayCards

PlayCards Problem Statement You are playing a card game, and in your hand, you are holding several cards. Each card has a suit, 'S', 'H', 'D', or 'C',and a value between 1 and 10, inclusive. You may play cards as part of a set, which is three or more cards of the same value,or as part of a run, which is three or more cards of the same suit, in sequential order. (Runs may not wrap, thus, 9-10-1 is not a valid run.) Each card may be played only once.For example, "1 S", "1 H" and "1 D" 阅读全文>

发表于 @ 2006年03月08日 14:17:00|评论(loading...)|举报|收藏

转载 google中国编程挑战赛资格赛真题 -- SkipStones

Problem Statement 问题描述 When a stone is thrown across water, sometimes it will land on the water and bounce rather than falling in right away. Suppose that a stone is thrown a distance of n. On each successive bounce it will travel half the distance as the previous bounce (rounded down to the nearest integer). When it can not travel any further, it falls into the water. If, at any point, the stone lands on an obstruction rather than water, it will not bounce, but will simply defl阅读全文>

发表于 @ 2006年03月08日 14:16:00|评论(loading...)|举报|收藏

2005年01月18日

原创 理解finalize()-析构函数的替代者【转载】

在许多方面,Java 类似于 C++。Java 的语法非常类似于 C++,Java 有类、方法和数据成员;Java 的类有构造函数; Java 有异常处理。但是,如果你使用过 C++ 会发现 Java 也丢掉一些可能是你熟悉的特性。这些特性之一就是析构函数。取代使用析构函数,Java 支持finalize() 方法。在本文中,我们将描述 finalize() 与 C++ 析构函数的区别。另外,我们将创建一个简单的 Applet 来演示 finalize() 是如何工作的。 阅读全文>

发表于 @ 2005年01月18日 07:24:00|评论(loading...)|举报|收藏

2005年01月17日

原创 [MMX指令版]黑白棋行动力的计算--指令拆分整理版(方便分析研究)

这个是去掉MMX指令配对和汇编指令配对,经过整理后的代码,阅读上应该更加直观一些,对于你理解其bitboard原理应该有很大的帮助,关于MMX指令的相关资料可以到google.com搜索一下,make_bitboard()函数是我的程序里的代码,由于篇幅不能列出所有代码,但我想聪明的你应该可以知道代码的大概意思。 阅读全文>

发表于 @ 2005年01月17日 01:31:00|评论(loading...)|举报|收藏

原创 [MMX指令版]黑白棋行动力的计算--原始版本(gcc汇编版)

WZebra作者Gunnar Andersson提供的原始版本,具体的网页我已经记不住了,使用了bitboard技术和MMX指令,这个是原始版本(gcc汇编版),必须在gcc下才可能编译。 阅读全文>

发表于 @ 2005年01月17日 00:54:00|评论(loading...)|举报|收藏

原创 [MMX指令版]黑白棋行动力的计算

这段代码是WZebra的作者Gunnar Andersson写的,作用是计算《黑白棋》双方的行动力,其中使用了bitboard技术和MMX指令,作者说他已经考虑了指令配对,请不要随意修改代码的先后顺序,除非你真的确定你是对的。原来的代码是gcc下的汇编格式,我把他转换过来而已,这个是在VC++ 6.0编译的版本,希望对你有点用处。阅读全文>

发表于 @ 2005年01月17日 00:45:00|评论(loading...)|举报|收藏

2005年01月11日

原创 手机中文码制问题的一点理解【转载】

前言:本来我也想自己写一些J2ME处理中文的帖子,因为我也经历了从什么都不懂,到慢慢掌握的过程,无意中发现了zhaofei的这篇文章,还总结得比较全面,而且关于UTF-8的说明部分我也不必去翻译了。如果有空,我再把我的体会写写出来,我曾经使用\uxxxx这种格式保存到rms,超级愚蠢,呵呵。 阅读全文>

发表于 @ 2005年01月11日 21:01:00|评论(loading...)|举报|收藏

2004年07月13日

原创 [原创]10^9进制高精度大整数减法(MMX版本)

本代码使用在分治法的时候,不必考虑数据对齐的问题(如果考虑就复杂了),len也是偶数,所以后面的len为奇数的检查部分是没有必要的,跟一般的方法快不了多少,微乎其微,在此仅提供另外一种思路,本人原创的,如果你有更好的方法请告知阅读全文>

发表于 @ 2004年07月13日 12:18:00|评论(loading...)|举报|收藏

原创 [原创]10^9进制高精度大整数加法(MMX版本)

本代码使用在分治法的时候,不必考虑数据对齐的问题(如果考虑就复杂了),len也是偶数,所以后面的len为奇数的检查部分是没有必要的,跟一般的方法快不了多少,微乎其微,在此仅提供另外一种思路,本人原创的,如果你有更好的方法请告知阅读全文>

发表于 @ 2004年07月13日 12:17:00|评论(loading...)|举报|收藏

原创 [Visual C++]在Win2000/XP上安静地替换正在使用的系统文件【转载/收藏】

要安静地替换正在使用的系统文件要解决两个问题: 1. 替换正在使用的文件. 2. 在替换系统文件时不显示插CD的对话框.阅读全文>

发表于 @ 2004年07月13日 12:05:00|评论(loading...)|举报|收藏

Csdn Blog version 3.1a
Copyright © 郭雄辉