摘要:
/*ID:tianlin2PROG:milkLANG:C++*/#include <iostream>#include <cstdlib>#include <fstream>using namespace std;typedef struct milk milk;struct milk{ int mon; int wei;};//最大农民数milk m[5000];int moncmp(const void *va,const void *vb){ milk *a,*b; a=(milk*)va; b=(milk*)vb; if(a->mon>b 阅读全文
posted @ 2010-02-21 23:53
CMuYu
阅读(149)
评论(0)
推荐(0)
摘要:
/*ID:tianlin2PROG:dualpalLANG:C++*/#include <iostream>#include <string>#include <fstream>using namespace std;bool ps(int n,int ary){ char a[]={'0','1','2','3','4','5','6','7','8','9'}; string b; while(n 阅读全文
posted @ 2010-02-21 19:10
CMuYu
阅读(129)
评论(0)
推荐(0)
摘要:
/*ID:tianlin2PROG:palsquareLANG:C++*/#include <iostream>#include <string>#include <cmath>#include <fstream>using namespace std;//貌似output函数是多余的,可以直接fout<<b;void output(ofstream &fout,string b){ for(int i=b.size()-1;i>=0;--i) fout<<b[i];}void ps(int n,int m, 阅读全文
posted @ 2010-02-21 19:01
CMuYu
阅读(161)
评论(0)
推荐(0)
摘要:
/*ID:tianlin2PROG:namenumLANG:C++*/#include <iostream>#include <string>#include <fstream>#include <cmath>using namespace std;int main(){ ofstream fout("namenum.out"); ifstream fin("namenum.in"); //m保存所对应名字的个数 long int m=0; //a保存输入的数字,c则保存字典里字符串所对应的数字,b则保存每 阅读全文
posted @ 2010-02-21 14:22
CMuYu
阅读(159)
评论(0)
推荐(0)
摘要:
/*ID:tianlin2PROG:transformLANG:C++*/#include <iostream>#include <fstream>using namespace std;//相等bool six(char a[][11],char c[][11],int h){ int i,j; for(i=0;i!=h;++i) for(j=0;j!=h;++j) { if(a[i][j]!=c[i][j]) return false; } return true;}//90°bool one(char a[][11],char c[][11],int h 阅读全文
posted @ 2010-02-21 13:18
CMuYu
阅读(176)
评论(0)
推荐(0)
摘要:
/*ID:tianlin2PROG:milk2LANG:C++*/#include <iostream>#include <fstream>using namespace std;int main(){ ofstream fout("milk2.out"); ifstream fin("milk2.in"); int be1[5000],end1[5000]; //a为奶牛数,b为不挤奶的时间,c为最长不挤奶的时间,x为至少一个人挤奶的时间,y为最长挤奶时间 int a,b=0,c=0,x=0,y=0; fin>>a; 阅读全文
posted @ 2010-02-21 12:56
CMuYu
阅读(189)
评论(0)
推荐(0)
摘要:
复杂度为O(n2):#include <stdio.h>#include <string.h>#include <assert.h>#define MAXN 400char necklace[MAXN];int len;/* * Return n mod m. The C % operator is not enough because * its behavior is undefined on negative numbers. *///这种处理 转一圈回到头 的情况很值得学习int mod(int n, int m){ while(n < 0) 阅读全文
posted @ 2010-02-21 11:50
CMuYu
阅读(152)
评论(0)
推荐(0)
摘要:
/*ID:tianlin2PROG:beadsLANG:C++*/#include <iostream>#include <fstream>using namespace std;//若函数里要改变变量的值,需引用bool eq(char &x,char &y){ if(x=='w'&&y=='b') return true; if(x=='b'&&y=='w') //注意函数里数据的变换 { y=x; return true; } if(x=='w& 阅读全文
posted @ 2010-02-21 10:23
CMuYu
阅读(129)
评论(0)
推荐(0)

浙公网安备 33010602011771号