#include <iostream>#include <math.h>#define maxn 100001const double e = 2.7182818284590452354, pi = 3.141592653589793239;double biao[maxn];using namespace std;main(){ int i; biao
原创 2009-03-10 12:41:18
463阅读
0MS  #include<stdio.h> #include<math.h> int main() { int i,k,n; while(scanf("%d",&n)!=EOF) { i=(int)sqrt(double(2*n)); if(i*i+i<n*2)i++; k=i*(i+1)/2;
原创 2009-03-16 21:26:47
347阅读
#include<stdio.h> #include<math.h> int main() { int i,k ; int n ,m; int sum=0; int a[102]={0}; scanf("%d",&k); while(k--) { scanf("%d",&n); for(m=1;m<=n;m
原创 2009-03-16 21:28:35
317阅读
#include<stdio.h> int main() { int a,b; int n,m; int sum,count; int i; while(scanf("%d%d",&m,&n)!=EOF) { if(m>n) { a=n; b=m; } else {a=m;
原创 2009-03-16 21:29:14
461阅读
http://poj.org/problem?id=3278可能写DFS写的比较习惯吧,每次只要遇到搜索提就会用DFS写。结果DFS版本各种剪枝后还是TLE郁闷。。求用dfs过的大牛代码。。后来用了bfs中间还是出了点小问题,考虑不认真造成的。BFSView Code #include <iostream>#include <cstring>#include <cstdio>#include <queue>using namespace std;int ans,s,e;bool visit[100007];struct node{ int pos
转载 2012-02-29 08:55:00
50阅读
2评论
#include<stdio.h> #include<math.h> #include<string.h> int main() { int i ; int n ,m; int sum=0; int a[20]={0}; while(1) { for(i=0;i<=16;i++) { if(a[0]==-
原创 2009-03-16 21:27:58
293阅读
#include<iostream>#include<algorithm> using namespace std; int data[10001]; int main(){    int cyle,i=0;    cin>>cyle;    while(cyle--
原创 2009-03-16 22:01:28
420阅读
题目如下: Description George took sticks of the same length and cut them randomly until all parts became at most 50 units long. Now he wants to return sticks to the original state, but he forgot how man
原创 2010-11-06 21:19:59
872阅读
/* pku 1579 */ #include <stdio.h> int s[21][21][21]={0}; int w(int a, int b, int c) { if (a <= 0 || b <= 0 || c <= 0) return 1; else if (a > 20 || b > 20 || c >
原创 2014-03-13 13:12:30
337阅读
//纯粹暴力AC,必须记住大数组一定要开成全局变量,因为函数里面的定义的变量都是放在栈堆中,太大会溢出即stack overflow #include<iostream> #include<string.h> using namespace std; int arr[500001]; bool used[3012500]; int main() { int n;
转载 精选 2014-03-13 21:15:56
340阅读
BabelfishTime Limit : 6000/3000ms (Java/Other) Memory Limit : 131072/65536K (Java/Other)Total Submission(s) : 11 Accepted Submission(s) : 8Problem DescriptionYou have just moved from Waterloo to a big city. The people here speak an incomprehensible dialect of a foreign language. Fortunately, you hav
转载 2012-12-24 15:05:00
484阅读
2评论
描述 小KITTY想要快速计算整数P的幂 (1 <= P <=10,000),它们需要你的帮助。因为计算极大数的幂,所以它们同一时间仅能使用2个存储器,每个存储器可记录某个结果值。第一件工作是初始化存储器内的值一个为底数x, 另一个为1。 小KITTY可以相乘或相除2个存储器中的值,并把结果存在其中某个存储器内,但所有存储的结果必须是整数。 例如, 如果他们想计算x^3
#include #include #include using namespace std; const int maxn = 65535; int vis[maxn+10]; int f(int sum, int i){ sum ^= 1 = 0) sum ^= 1 ss; ss.push(sum); whil...
qt
原创 2021-07-15 15:06:42
81阅读
http://poj.org/problem?id=3273http://poj.org/problem?id=32583273:题意就是John计算了他接下来的n天里每天将要花的钱数,他想将这些天划分成连续的m段,求出这m段中最大花费。以保证他在每一段时间里都不会缺钱花:思路:将这n天分成一段的话,最大钱数就是其所有钱数的和,如果分成n段的话就是这些钱数里面最大值,然后二分枚举钱数,如果枚举的钱数将这n个数分成大于m段的话,就说明二分枚举的钱数小了,l = mid + 1,否则 r = mid - 1;最后输出l就可以了。。。#include <iostream>#include
转载 2012-05-19 16:49:00
46阅读
2评论
PKU题目分类(1) (我觉得动态规划部分的题目都非常好。) http://hi.baidu.com/xjj59307/blog/item/2d8ef05966e9a8d79d8204cf.html PKU题目分类(2) http://hi.baidu.com/xjj59307/blog/item/aad311f183e341a6a50f52cf.html  
转载 精选 2011-04-22 14:04:40
430阅读
简单地DFSOil DepositsTime Limit:1000MSMemory Limit:10000KTotal Submissions:12801Accepted:6998DescriptionThe GeoSurvComp geologic survey company is respon...
转载 2015-07-08 11:53:00
103阅读
2评论
<span style="color:#6600cc;">/* B - Cow Multiplication Time Limit:1000MS Memory Limit:65536KB 64bit IO Format:%I64d & %I64u Submit Status Practice POJ 3673 Description Bessie is
转载 2017-04-18 14:23:00
80阅读
2评论
分析:刚开始没看懂题目,后来才明白。。有n种药,当奇数时间吃时会减少弹跳,当偶数时会增加。由于只能吃一次所以用状态压缩就可以了,  #include"stdio.h"#include"string.h"int main(){ int n,x; int a,b; scanf("%d",&n); a=b=0; while(n--) { scanf("%d",&x);
转载 2013-05-01 12:07:00
48阅读
2评论
 http://poj.org/problemlist 1、   排序 1423, 1694, 1723, 1727, 1763, 1788, 1828, 1838, 1840, 2201, 2376, 2377, 2380, 1318, 1877, 1928, 197
转载 精选 2010-10-07 17:36:26
858阅读
问题描述 给定N * N矩阵A,其元素为0或1.A [i,j]表示第i行和第j列中的数字。最初我们有A [i,j] = 0(1 <= i,j <= N)。 我们可以通过以下方式更改矩阵。给定一个左上角为(x1,y1)且右下角为(x2,y2)的矩形,我们使用“not”操作更改矩形中的所有元素(如果是'
转载 2019-02-09 22:55:00
82阅读
2评论
  • 1
  • 2
  • 3
  • 4
  • 5