https://oj.leetcode.com/problems/swap-nodes-in-pairs/ Given a linked list, swap every two adjacent nodes and return its head. For example,Given 1->2->...
分类:
其他好文 时间:
2015-03-04 19:03:40
阅读次数:
145
题意:X坐标上有n个数。JOHN想知道有多少对数满足:x[a]-x[b]>T; while(T--){ cin>>n>>k; rep(i,1,n) scanf("%d",&x[i]); sort(x+1,x+1+n); ll ans=0;...
分类:
其他好文 时间:
2015-03-03 23:23:58
阅读次数:
149
Alice bought a lot of pairs of socks yesterday. But when she went home, she found that she has lost one of them. Each sock has a name which contains e...
分类:
其他好文 时间:
2015-03-01 22:21:59
阅读次数:
286
传送门:http://acm.hdu.edu.cn/showproblem.php?pid=5178
pairs
Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)
Total Submission(s): 320 Accepted Submission(...
分类:
其他好文 时间:
2015-03-01 17:08:08
阅读次数:
283
题目链接:http://poj.org/problem?id=1470Write a program that takes as input a rooted tree and a list of pairs of vertices. For each pair (u,v) the program ...
分类:
其他好文 时间:
2015-02-28 17:55:04
阅读次数:
143
思路1: class Solution {
public:
// 两个指针,p, q, q指向第二个,preP是p之前 ListNode *swapPairs(ListNode *head) { if(head == NULL) return NULL; auto p = head; auto q ...
分类:
其他好文 时间:
2015-02-26 13:10:49
阅读次数:
133
Given a linked list, swap every two adjacent nodes and return its head.For example,Given1->2->3->4, you should return the list as2->1->4->3.Your algor...
分类:
其他好文 时间:
2015-02-25 15:35:59
阅读次数:
126
传送门:Pairs Forming LCM题意:题意:问符合 lcm(i,j)=n (1#include #include #include #include #include #include #include #include #include #include #include #includ...
分类:
其他好文 时间:
2015-02-24 15:03:11
阅读次数:
130
Problem DescriptionThe inversion number of a given number sequence a1, a2, …, an is the number of pairs (ai, aj) that satisfy i aj.For a given sequence of numbers a1, a2, …, an, if we move...
分类:
其他好文 时间:
2015-02-23 23:44:23
阅读次数:
400
??
练习2.40
这道题要我们写一个传入一个整数n然后返回一个序对(i, j)的过程unique-pairs,然后用于上一页的prime-sum-pairs的定义。此时我们要注意在prime-sum-pairs中哪一段代码表达的是这个意思。没错,是flatmap函数。因此我们将其写入到unique-pairs中。
(define (unique-pairs n)
(...
分类:
其他好文 时间:
2015-02-23 09:45:37
阅读次数:
155