题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=2686Yifenfei very like play a number game in the n*n Matrix. A positive integer number is put in each a...
分类:
其他好文 时间:
2015-03-12 13:04:42
阅读次数:
164
题意:When given an array(a0,a1,a2,?an?1)and an integerK, you are expected to judge whether there is a pair(i,j)(0≤i≤j st;ll ans,K;int n;int T;ll a[10000...
分类:
其他好文 时间:
2015-03-11 21:20:46
阅读次数:
143
Negative and Positive (NP)Time Limit: 3000/1500 MS (Java/Others)Memory Limit: 65536/65536 K (Java/Others)Total Submission(s): 2177Accepted Submission(...
分类:
其他好文 时间:
2015-03-11 21:13:52
阅读次数:
121
题目:Lowest BitTime Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 8722 Accepted Submission(s): 6428Problem DescriptionGiven an positive integer A ...
分类:
其他好文 时间:
2015-03-11 17:11:56
阅读次数:
140
Given an unsorted integer array, find the first missing positive integer.
For example,
Given [1,2,0] return 3,
and [3,4,-1,1] return 2.
Your algorithm should run in O(n) time and uses constant spa...
分类:
其他好文 时间:
2015-03-10 10:26:23
阅读次数:
136
Given a positive integer, return its corresponding column title as appear in an Excel sheet.
class Solution {
public:
string convertToTitle(int n) {
string s;
while(n){
...
分类:
其他好文 时间:
2015-03-10 00:14:37
阅读次数:
188
题目:http://codeforces.com/contest/402/problem/E题意:给你一个矩阵a,判断是否存在k,使得a^k这个矩阵全部元素都大于0分析:把矩阵当作01矩阵,超过1的都当作1,那么a矩阵可表示一个有向图的走一次的连通性,则a^k表示有向图走K次的连通性。既然要求最后都...
分类:
移动开发 时间:
2015-03-09 23:48:38
阅读次数:
210
题目:大概意思就是给定一个序列a[0],a[1]....a[n-1]和一个整数k,问是否有这样的两个下标是的NP-Sum(i,j)=k,这里NP-Sum(i,j)=a[i]-a[i+1]+a[i+2]-...+(-1)^(j-1)*a[j]。
思路:我们可以维护这个序列的后缀和(前缀也是可以的),然后枚举sum[i]查看在set表中是否存在sum[j]=sum[i]-k。
这里要分成i...
分类:
其他好文 时间:
2015-03-09 22:33:42
阅读次数:
195
PART I: IntegerThere are two types of integer : unsigned integer(only positive) & signed integer(positive,negative and 0)So how does a computer storag...
分类:
移动开发 时间:
2015-03-09 20:45:20
阅读次数:
148
http://bestcoder.hdu.edu.cn/contests/contest_showproblem.php?pid=1002&cid=570给定一个数组(a0,a1,a2,?an?1)和一个整数K, 请来判断一下是否存在二元组(i,j)(0≤i≤j#include#include#in...