1 #include 2 #include 3 using namespace std; 4 int main(){ 5 string s; 6 int i,sum; 7 getline(cin,s); 8 for(i=0;i='0')10 ...
分类:
其他好文 时间:
2014-07-06 23:41:23
阅读次数:
279
1 #include 2 #include 3 using namespace std; 4 int main(){ 5 string s; 6 int i,sum=0; 7 bool flag=false,f=false; 8 getline(cin,s); 9 ...
分类:
其他好文 时间:
2014-07-03 23:32:12
阅读次数:
304
规定sum[i] 为i里面含1的个数 ,求从1-N sum[i]的乘积。数为64位内的,也就是sum[i] 2 #include 3 #include 4 #include 5 #include 6 #include 7 #include 8 #include 9 #include10 using ...
分类:
其他好文 时间:
2014-07-03 21:51:43
阅读次数:
209
1 #include 2 using namespace std; 3 int main(){ 4 int n,sum=1; 5 cin>>n; 6 while(--n) 7 sum=(sum+1)*2; 8 cout<<sum<<endl; 9 ...
分类:
其他好文 时间:
2014-07-03 21:46:34
阅读次数:
253
1 #include 2 #include 3 using namespace std; 4 int main(){ 5 int i,j,n,p[10],q,sum; 6 cin>>n; 7 for(i=0;i<=9;++i){ 8 p[i]=pow(i,n...
分类:
其他好文 时间:
2014-07-03 21:39:20
阅读次数:
210
Given two binary trees, write a function to check if they are equal or not.
分类:
其他好文 时间:
2014-07-03 19:26:46
阅读次数:
213
What is the Median?
The Problem
Median plays an important role in the world of statistics. By definition, it is a value which divides an array into two equal parts. In this problem you are ...
分类:
其他好文 时间:
2014-07-03 17:43:53
阅读次数:
250
[LeetCode]Merge Two Sorted Lists...
分类:
其他好文 时间:
2014-07-03 16:37:12
阅读次数:
181
拖了好久才写的。
【BZOJ2821】接触分块大法。这道题略有点新颖。首先我们先分块,然后统计每块中每个数出现的个数。
下面是联立各个方块,预处理出第I个方块到第J个方块出现正偶数次数的个数。
for (i=1;i<=s;i++)
{
for (j=i;j<=s;j++)
{
sum[i][j]=sum[i][j-1];
for (k=a[j].l...
分类:
其他好文 时间:
2014-07-03 13:38:35
阅读次数:
160
Given a binary tree and a sum, determine if the tree has a root-to-leaf path such that adding up all the values along the path equals the given sum.
分类:
其他好文 时间:
2014-07-03 13:02:23
阅读次数:
200