质因数分解
/* 求质因数 */
#include
#include
int main()
{
int n,a=2;
printf("please input n:");
scanf("%d",&n);
if(n<=1)
{
printf("input error!\n");
return -1;
}
while(a*a < n)
{
while(n%a==0)
...
分类:
其他好文 时间:
2014-05-26 05:50:40
阅读次数:
279
RPC(remote procedure call)不同java进程间的对象方法调用,一方称作服务端,一方称作客户端;被调用的对象的方法执行发生在server端
首先应该编写服务端MyServer,客户端MyClient,操作对象类MyBiz(根据服务端方法参数推测的),操作对象接口MyBizable(根据客户端方法参数推测的)
通过查看源码,一步步向里查看,直到没有return该方法出现...
分类:
编程语言 时间:
2014-05-26 05:34:16
阅读次数:
471
出题:一个长度为N的数组,其中的元素取值范围是1到N,要求快速判断数组是否存在重复数字;分析:解法1:如果N个元素的范围都是在1到N,所以如果没有重复元素,则每一个位置恰好可以对应数组中的一个元素之,通过将当前元素k交换到其本身应该在的位
置k,也就是k=array[i], array[array[...
分类:
其他好文 时间:
2014-05-26 03:10:21
阅读次数:
191
求最大公约数。 1 //Accepted 228 KB 0 ms 2 #include 3
#include 4 int gcd(int a,int b) 5 { 6 if (b==0) return a; 7 return gcd(b,a%b); 8
} 9 int...
分类:
其他好文 时间:
2014-05-26 02:54:42
阅读次数:
199
Format是一个很常用,却又似乎很烦的方法,本人试图对这个方法的帮助进行一些翻译,让它有一个完整的概貌,以供大家查询之用:首先看它的声明:function
Format(const Format: string; const Args: array of const): string; overl...
分类:
其他好文 时间:
2014-05-25 02:04:12
阅读次数:
416
题目:
Given an array S of n integers, are there elements a, b, c in S such that a + b + c =
0? Find all unique
triplets in the array which gives the sum of zero.
Note:
Elements...
分类:
其他好文 时间:
2014-05-25 00:39:37
阅读次数:
343
double qiuzhi(int id)
{
double t1=cc[id].rid*cc[id].rid;
double t2=w*w/4;
double t3=t1-t2;
double t4=sqrt(t3);
return t4;
}
void to_qujian()
{
for(int i=0; i<t; i++)
{
...
分类:
其他好文 时间:
2014-05-24 23:23:20
阅读次数:
363
只是实现了链表ADT的部分功能。
/*---编写打印出一个单链表的所有元素的程序---*/
#include
#include
struct Node{
int val;
struct Node *next;
};
Node *findEnd(Node *list){
while(list->next) list = list->next;
return list;
}
v...
分类:
其他好文 时间:
2014-05-24 22:30:37
阅读次数:
232
之所以说leetcode的测试用例有问题,是因为我刚开始理解错了题意,写下了如下的错误的代码。但是却AC了。
错误代码为:
bool canJump(int A[], int n) {
if(n == 0) return true;
int sum = 0; //记录当前的最远距离
int i = 0;
...
分类:
其他好文 时间:
2014-05-24 19:45:57
阅读次数:
1081
Palindrome Partitioning
Given a string s, partition s such that every substring of the partition is a palindrome.
Return all possible palindrome partitioning of s.
For example, given s = "...
分类:
其他好文 时间:
2014-05-24 14:29:45
阅读次数:
222