摘要: // hnldyhy(303882171) 15:56:57 // poj 1988/*思路:找到含X的那叠箱子的箱子总数减去X上面的箱子数再减1就是所要的答案。如果a堆在b上,那么b上面的箱子数就是等于含a的那叠箱子的总数;*/#include #define N 30001int p[N];i... 阅读全文
posted @ 2014-08-10 20:03 2014acm 阅读(162) 评论(0) 推荐(0)
摘要: //1482#include #include using namespace std;int n,d;struct point{ int x,y,z,t;}a[1005];int find(int x ){ if(a[x].z==x) return x; else return ... 阅读全文
posted @ 2014-08-10 20:02 2014acm 阅读(107) 评论(0) 推荐(0)
摘要: //1481#include #include using namespace std;#define N 50010int parent[N],sum;void init(){ for(int i=1;in || y> n) {sum--;continue;} ... 阅读全文
posted @ 2014-08-10 20:01 2014acm 阅读(146) 评论(0) 推荐(0)
摘要: #include #includeusing namespace std;#define N 50010int p[N]; void init(int n){ for(int i=1 ;i#include #include #include #include #include using name... 阅读全文
posted @ 2014-08-10 19:59 2014acm 阅读(191) 评论(0) 推荐(0)
摘要: // hnldyhy(303882171) 17:07:57// poj 1703#include int p[200005];void init(int n){ for (int i=1;i#includeusing namespace std;#define N 500001int ... 阅读全文
posted @ 2014-08-10 19:52 2014acm 阅读(150) 评论(0) 推荐(0)
摘要: //1480#includeconst int MAX=50010; int p[MAX];int n,m;void init(int k) { for (int i=1; iconst int MAX=50010;int p[MAX];int n,m;void init(int k){fo... 阅读全文
posted @ 2014-08-10 19:47 2014acm 阅读(77) 评论(0) 推荐(0)
摘要: const int MAX=1010; //元素个数的最大值,根据题目修改int p[MAX];void init(int n) //n为实有元素个数{ for (int i=1; i<=n; i++) p[i]=i; }int find(int x) //查找{ if (x==p[x]) retu... 阅读全文
posted @ 2014-08-10 19:43 2014acm 阅读(99) 评论(0) 推荐(0)
摘要: //hnldyhy(303882171) 11:12:46// zoj 1649//bfs +优先队列#include #include #include using namespace std;struct node{ int x; int y; int step;};bool... 阅读全文
posted @ 2014-08-10 19:35 2014acm 阅读(375) 评论(0) 推荐(0)
摘要: //zoj 1586#include#includeusing namespace std;#define N 1005int a[N][N],low[N],n,ans;int b[N];int min(int x,int y){ return x#includeusing namespace... 阅读全文
posted @ 2014-08-10 19:31 2014acm 阅读(176) 评论(0) 推荐(0)
摘要: #include#includeusing namespace std;#define N 1005int a[N][N],low[N],n,ans;int b[N];int min(int x,int y){ return xci) { a[ai-1][bi-1]=c... 阅读全文
posted @ 2014-08-10 19:28 2014acm 阅读(100) 评论(0) 推荐(0)
摘要: 输入:8 91 21 32 42 53 63 74 85 86 7// 图的BFS,使用C++队列#include #include #include using namespace std;#define N 10int g[N][N],bz[N],n,m;queue q;void BFS(in... 阅读全文
posted @ 2014-08-10 19:25 2014acm 阅读(248) 评论(0) 推荐(0)
摘要: #include // poj 1258 10.1.5.253 1505using namespace std; #define N 105 // 顶点的最大个数 (多写 int a[N][N],low[N],n,ans;int min(int x,int y){ ... 阅读全文
posted @ 2014-08-10 19:20 2014acm 阅读(111) 评论(0) 推荐(0)
摘要: #include #include #include #include #include using namespace std;struct node{ char msg[20]; int a,b;};struct cmp{ bool operator()(const node ... 阅读全文
posted @ 2014-08-10 19:02 2014acm 阅读(220) 评论(0) 推荐(0)
摘要: #include #include #include #include #include using namespace std; int main(){ vector phonelist; int testcast; cin >> testcast;... 阅读全文
posted @ 2014-08-10 19:00 2014acm 阅读(111) 评论(0) 推荐(0)
摘要: #include #include #include #include using namespace std;int main(){ int n,i,j; string s; mapm; map :: iterator it,it2; while(cin>>n... 阅读全文
posted @ 2014-08-10 18:59 2014acm 阅读(143) 评论(0) 推荐(0)
摘要: #include#includeusing namespace std;int main(void){ while(true) { set s; int n, doubles = 0; while(cin>>n && n) { if(n == -1) ... 阅读全文
posted @ 2014-08-10 18:56 2014acm 阅读(187) 评论(0) 推荐(0)
摘要: #include #include#define N 10int g[N][N];int bz[N];int n,m ;void DFS(int cur){ int j; bz[cur]=1; printf("V%d",cur); for(j=1;j<=n ;j++ ) if(g[cur][j] ... 阅读全文
posted @ 2014-08-10 18:50 2014acm 阅读(213) 评论(0) 推荐(0)
摘要: // zoj 2110#include #include #include using namespace std;char map[9][9]; //迷宫地图int n,m,t; //迷宫的大小,及迷宫的门会在第t... 阅读全文
posted @ 2014-08-10 18:47 2014acm 阅读(139) 评论(0) 推荐(0)
摘要: greater 从小到大lesser 总大到小#include#includeusing namespace std;int main(){ int n,m,t,x,y; long long s; priority_queue ,greater > my; cin>>n; ... 阅读全文
posted @ 2014-08-10 18:33 2014acm 阅读(125) 评论(0) 推荐(0)
摘要: STL的队列和栈简单使用 #include #include #include #include #include #include using namespace std;int main(){ queue Q; stack S; int i; for(i=1;i M //例如 queue ... 阅读全文
posted @ 2014-08-10 18:25 2014acm 阅读(159) 评论(0) 推荐(0)
摘要: #include #include #include #include #include #include using namespace std;struct node{ int m,n; // bool f;};node hash[200];char s[1000];int main(... 阅读全文
posted @ 2014-08-10 18:23 2014acm 阅读(150) 评论(0) 推荐(0)
摘要: #include #include #include using namespace std; class rect //类 声明公有 { public: int ... 阅读全文
posted @ 2014-08-10 18:20 2014acm 阅读(124) 评论(0) 推荐(0)
摘要: #include 头文件atof 将字符串 转化为 一个双精度值 int atof(a) #include #includedouble exp(){ char a[20];scanf("%s",a) ;switch(a[0]) { case'+': re... 阅读全文
posted @ 2014-08-10 18:13 2014acm 阅读(106) 评论(0) 推荐(0)
摘要: #include#include#includeusing namespace std;int main(){int n,i;char s[100];char s1[100],s2[100],s3[100];scanf("%d%*c",&n);for(i=1;i#include using name... 阅读全文
posted @ 2014-08-10 18:05 2014acm 阅读(116) 评论(0) 推荐(0)
摘要: C语言:数组8(统计各分数段的人数)时间限制(普通/Java):1000MS/3000MS 运行内存限制:65536KByte总提交:491 测试通过:298描述输入一个班C语言的考试成绩,统计0-59、60-69、70-79、80-89、90-100每个分数... 阅读全文
posted @ 2014-08-10 17:55 2014acm 阅读(302) 评论(0) 推荐(0)
摘要: 极目,远眺(752284118) 16:03:43poj 1002 用C++提交AC,G++超时#include #include #include #include #include using namespace std;map my;char a[30]="22233344455566677... 阅读全文
posted @ 2014-08-10 17:53 2014acm 阅读(187) 评论(0) 推荐(0)
摘要: #include #include #include //头文件 using namespace std;map my; //全局变量 0 map ::iterator it ; //指针 int main( ){ int i ; strin... 阅读全文
posted @ 2014-08-10 17:52 2014acm 阅读(144) 评论(0) 推荐(0)
摘要: #include //从小到大排列#include#includeusing namespace std;int main(){ int i,x; vectormy ; for(i=1;i>x; my.push_back(x); } sort(my.begin(),my.end()); f... 阅读全文
posted @ 2014-08-10 17:47 2014acm 阅读(104) 评论(0) 推荐(0)
摘要: #include #includeusing namespace std;bool cmp(int a,int b) { return a>a[i] ; sort(a,a+10); for(i=0;i#includeusing namespace std;int main( ){ int ... 阅读全文
posted @ 2014-08-10 17:37 2014acm 阅读(184) 评论(0) 推荐(0)
摘要: #include #includeusing namespace std;int a[5];int main( ){ int i; for(i=0;i>a[i] ; sort(a,a+5); for(i=0;i#includeusing namespace std;int a[5];boo... 阅读全文
posted @ 2014-08-10 17:21 2014acm 阅读(130) 评论(0) 推荐(0)
摘要: accept#include#include#include#includeusing namespace std;char ss[20005][25];int num[20005];int n,m;int cmp(const void * a,const void * b){ int i,a... 阅读全文
posted @ 2014-08-10 17:15 2014acm 阅读(264) 评论(0) 推荐(0)
摘要: #include #include using namespace std;int main(){ int i,k,n,a[10000]; cin>>n; for(i=0;i>a[i]; sort(a,a+n); cout#include using name... 阅读全文
posted @ 2014-08-10 16:59 2014acm 阅读(85) 评论(0) 推荐(0)
摘要: 算法分析与设计:搜索(素数环)时间限制(普通/Java):1000MS/3000MS 运行内存限制:65536KByte 总提交:178 测试通过:35描述将1-n这n个数摆成一个环,要求相邻的两个数的和是一个素数,编程输出所有可能的解。输入包括多组数据,每组1个数n。nusin... 阅读全文
posted @ 2014-08-10 16:31 2014acm 阅读(170) 评论(0) 推荐(0)
摘要: 小试探#include #includestruct word{ char a[20],b[20];}w[100005];int main(int argc, char *argv[]){ int len=0; char s[100],x[20],y[20]; int i; while(gets(s... 阅读全文
posted @ 2014-08-10 11:18 2014acm 阅读(166) 评论(0) 推荐(0)
摘要: #includemain(){ float x=2.5,y,x1=2.5,a,b,c,d,max,min; scanf("%f%f%f%f",&a,&b,&c,&d); do { y=x-(a*x*x*x+b*x*x+c*x+d)/(3*a*x*x+2*b*x+... 阅读全文
posted @ 2014-08-10 11:11 2014acm 阅读(109) 评论(0) 推荐(0)
摘要: #include int main(){ float a,b,c,d,x,y,max,min; max=10; min=-10; scanf("%f%f%f%f",&a,&b,&c,&d); { x=(max+min)/2; y=a*... 阅读全文
posted @ 2014-08-10 11:07 2014acm 阅读(102) 评论(0) 推荐(0)
摘要: #includeint f(int a[],int low,int high,int x){ int mid; while (lowx) high=mid-1; else if(a[mid]int f(int a[],int low,int high,int x)... 阅读全文
posted @ 2014-08-10 10:46 2014acm 阅读(90) 评论(0) 推荐(0)
摘要: #include #include #include #include using namespace std;int a,b,used[200020];queueq;int ok(int n){ if(n = 0&&used[n]==0) return 1; ... 阅读全文
posted @ 2014-08-10 08:23 2014acm 阅读(146) 评论(0) 推荐(0)