
ACM
文章平均质量分 63
microsoftwin32
这个作者很懒,什么都没留下…
展开
专栏收录文章
- 默认排序
- 最新发布
- 最早发布
- 最多阅读
- 最少阅读
-
杭电ACM 1172
//杭电ACM1172//猜数字#includeusing namespace std;int array[100][3];bool test(int a,int b){ int d[4]={0}; int count1=0;//统计在正确位置的数字的个数 int count2=0;//统计猜对的数字个数 int array1[4]; int array转载 2012-05-27 17:32:34 · 1046 阅读 · 0 评论 -
POJ1700 渡河
#include#includeusing namespace std;int cmp(const void*p1,const void*p2){ const int* a1=(const int*)p1; const int* a2=(const int*)p2; if(*a1<*a2) return -1; else if(*a1==*a2) ret原创 2012-06-26 15:42:14 · 446 阅读 · 0 评论 -
ZOJ1457素数环
抄的别人的,似懂非懂,先放在博客上,以后再看。#include#include#includeusing namespace std;const int maxn=21;int result[maxn];//存储圆圈中的数int hash[maxn];int n;void dfs(int depth);inline bool isPrim(int num);转载 2012-06-22 13:16:09 · 604 阅读 · 0 评论 -
POJ1002电话号码
#include#include#includeusing std::string;using namespace std;int n;char a[100001][20],str[50];char map[]="222333444555666777888999";int compare(const void *p,const void*q){ return转载 2012-06-17 22:39:23 · 911 阅读 · 0 评论 -
求两个数的最大公因子
//求两个数的最大公因子#includeusing namespace std;void swap(int m,int n){ int temp=m; m=n; n=temp;}void result(int a,int b){ if(a<b) swap(a,b); bool judge=true; while(judge) {原创 2012-05-26 11:17:26 · 1434 阅读 · 0 评论 -
求两个数的最小公倍数
#includeusing namespace std;void swap(int a,int b)//交换两个数{ int temp=a; a=b; b=temp;}void result(int m,int n){ if(m>n)//如果m>n交换m和n swap(m,n); for(int i=m;i<=m*n;i++) if(i%m=原创 2012-05-26 10:46:41 · 576 阅读 · 0 评论 -
杭电ACM1051箍木
如果当前要做的木板的宽度和长度都不小于前面做的一个,则做现在这个木板不用花时间,输入很多木板的长与宽,求做这些木板所花的最短时间,否则需要一分钟贪心法#includeusing namespace std;typedef struct stick{ int length; int weight; bool flag;}Stick;bool compare原创 2012-06-14 17:15:38 · 1448 阅读 · 0 评论 -
2005年百度之星程序设计大赛试题初赛题目的第一题(求出一个整数的连续整数的和)
#includeusing namespace std;void show(int m,int n,int p){ if(m!=n) { cout<<endl<<p<<'='; for(int i=m;i<n;i++) cout<<i<<'+'; cout<<n; cout<<endl; }}void qiuhe(int c,int原创 2012-06-13 14:58:07 · 638 阅读 · 0 评论 -
POJ1042 钓鱼
#includeusing namespace std;int main(){ int n,h,f[26]={0},d[26]={0},t[26]={0},fs[26];//h是以小时为单位 cout<<"输入湖的数量:"<<endl;//1 while(cin>>n) { int i,j; if(n==0) break; cout<<"输入拥有的时间原创 2012-06-07 15:52:07 · 1338 阅读 · 1 评论 -
售票员
点击打开链接#includedouble p,q,x;int pp,qq;int main(){ while(scanf("%lf%lf",&p,&q)!=EOF) { if(p>q) { int temp=p; p=q; q=temp; } if(!(p&&q)) printf("%s\n","Error!");原创 2012-06-05 14:17:14 · 493 阅读 · 0 评论 -
杭电1176 免费馅饼
//杭电1176 免费馅饼//动态规划问题#includeusing namespace std;int dp[11][100001];inline int Max(int a,int b,int c=-1){ if(a<b)a=b; if(a<c)a=c; return a;}int main(){ int n,i,j; int t,x;转载 2012-06-03 21:46:58 · 1221 阅读 · 0 评论 -
杭电ACM2084
//杭电ACM 2084 数塔//动态规划问题(DP)入门#includeusing namespace std;int main(){ int C=0,i,j; int array[110][110]={0}; cout<<"Enter C: "; cin>>C; while(C--) { int N=0; cout<<"Input N:原创 2012-06-01 21:01:56 · 768 阅读 · 0 评论 -
杭电ACM 1175
//杭电ACM 1175//连连看#includeusing namespace std;int board[1000][1000];void swap(int&a,int&b){ int temp=a; a=b; b=temp;}bool judge(int h1,int l1,int h2,int l2,int n1,int m1){ int转载 2012-05-31 15:14:13 · 744 阅读 · 0 评论 -
杭电ACM 1174
//身高,又称身长,是指一个人从头顶到脚底的身体长度.//杭电ACM 1174 爆头#include#includeusing namespace std;#define eps 1e-6struct Node{ double x,y,z;}line[2];double chaji(Node&a,Node&b)//计算两个向量的叉积 { double转载 2012-05-29 22:10:12 · 2696 阅读 · 0 评论 -
杭电ACM1173
#include#includeusing namespace std;double a[1000000]={0};double b[1000000]={0};void swap(double&n1,double&n2){ double temp=n1; n1=n2; n2=temp;}int PartTion(double A[],int m,int原创 2012-05-28 14:32:09 · 590 阅读 · 0 评论 -
输入一行数字,如果我们把这行数字中的‘5’都看成空格,那么就得到一行用空格分割的若干非负整数(可能有些整数以‘0’开头,这些头部的‘0’应该被忽略掉,除非这个整数就是由若干个‘0’组成的,这时这个整数
#include#includeusing std::string;using namespace std;const int MAX_NUM=1000;void merge(long num[],int n);int main(){ string str; while(cin>>str) { int len=str.size(); long n转载 2012-05-26 15:28:45 · 9368 阅读 · 0 评论 -
杭电ACM1166
//杭电ACM敌兵布阵问题//用链表的方法实现//链表使用数组实现的#ifndef LIST_H_#define LIST_H_const int MAX_LIST=5000;typedef int ListType;class List{public: List(); bool isEmpty()const; int getLength()cons原创 2012-05-27 10:01:20 · 1012 阅读 · 0 评论 -
POJ3624 0-1背包问题
典型的0-1背包问题#includeusing namespace std;const int SIZE=40000;int weight[SIZE],value[SIZE],DP[SIZE];int main(){ int N,M,i,j; cin>>N>>M; memset(weight,0,sizeof(weight)); memset(value,0原创 2012-06-29 13:47:30 · 573 阅读 · 0 评论