- 博客(80)
- 资源 (9)
- 收藏
- 关注
原创 字符串反转
#include#include#includeusing namespace std;int convert(string s){ char c[10][20]; int i=0; int j=0; int k=0; while(s[i]!='\0') { if(s[i]!=' ') { c[j][k]=s[i]; k++; i++; }
2013-04-22 15:40:31 422
原创 Help Captain Chen Ⅰ
DescriptionRecently, more and more students pay attention to a funny game called ACM, including Captain Chen. He finds that to compete in the Finals he must get a good rank in the Regionals
2013-03-22 09:57:26 551
原创 flody
参考文献#includeusing namespace std;int MAX_DIS=999;int graph[50][50];int dis[50][50];int path[50][50];int n;void flody(){ int i,j,k; for(k=1;k<=n;k++) { for(int i=1;i<=n;i++) { for(
2013-03-21 14:45:53 628
原创 并差集
DescriptionDo you know a software called "WeiXin", a kind of chatting tool? There is an application called "Shaking for a while". Once you shake your cellphone, you can find those who shake their
2013-03-20 14:07:05 468
原创 poj 1068
#include#include#include#include#includeusing namespace std;void run(int a[],int t){ int i,j; vector vs; int visited[110]={0}; stack ss; vector result; for(i=1;i<=t;i++) { int s=a[i]-a
2013-03-19 15:37:56 370
原创 1328
#include#includeusing namespace std;float min(float a,float b){ return a<b?a:b;}int main(){ int n,d; float a[1001][3]; float dis[1001][3]; int cs=0; cin>>n>>d; while(n!=0) { cs++; i
2013-03-17 20:31:58 376
原创 图的深度搜索完整实现(邻接表,DFS)
//构造邻接表,深度优先搜索#include#include#define null NULLusing namespace std;typedef struct nd{ int key; struct nd * next;}node;typedef struct ndl{ int count; node * first;}nodelist;int n=6;node
2013-03-12 16:13:01 563
原创 图的广度搜索完整实现(邻接表,队列,BFS)
//构造邻接表,队列,广度优先搜索#include#include#define null NULLusing namespace std;typedef struct nd{ int key; struct nd * next;}node;typedef struct ndl{ int count; node * first;}nodelist;typedef st
2013-03-12 15:41:03 545
原创 Tautology
#include#include#includeusing namespace std;int main(){ string s; while(cin>>s) { bool b=true; if(s=="0") break; else { stack sint; for(int tp=0;tp<=1;tp++) { for(int t
2012-12-28 09:28:14 221
原创 msquare 有点超时
#include#include#includeusing namespace std;#define null NULL;typedef struct node{ struct node * parent;//保存父节点 string content;//保存本节点的操作序列 int c[10];//保存本节点的状态}node;typedef struct sequenc
2012-11-14 20:19:59 218
原创 Feed Ratios
#include#includeusing namespace std;ifstream fin ("ratios.in");ofstream fout ("ratios.out");int main(){ int rx=0,ry=0,rz=0; int x=0,y=0,z=0; int N=0; int k[4]={0}; int a[4]={0},b[4]={0},c[4
2012-11-07 22:13:27 234
原创 spin
#include#includeusing namespace std;int main(){ ifstream fin ("spin.in"); ofstream fout ("spin.out"); int i,j,k; int time=0; int speed[6]={0}; int gapcount[15]={0}; int gap[6][15][3]={0};
2012-11-03 15:16:44 246
原创 factorials
#include#includeusing namespace std;ifstream fin ("fact4.in");ofstream fout ("fact4.out");int main(){ int n,i; int time5=0;//记录5的个数 int time0=0;//记录0的个数 int result=1;//保存结果 int arr[4222]={0
2012-10-23 18:58:22 266
原创 stamps+动态规划
#include#include#includeusing namespace std;int main(){ ifstream fin ("stamps.in"); ofstream fout ("stamps.out"); int k,n; int i; int f[200001]={0}; int value[100]={0}; f[0]=0; fin>>k>>n;
2012-10-19 09:11:39 319
原创 contact+枚举方法
#include#include#include#includeusing namespace std;#define M 12#define N 4096int main(){ int res[M+1][N+1]; ifstream fin ("contact.in"); ofstream fout ("contact.out"); char input[200001];
2012-10-14 22:28:54 14317
原创 Shaping Regions //附错误解法
//#include//#include//using namespace std;//int color[810][810]={1};//int values[1005]={0};//int main()//{// ifstream fin ("rect1.in");// ofstream fout ("rect1.out");// int shapes[1005];//保存每
2012-10-12 20:29:58 270
原创 Humble Numbers
#include#includeusing namespace std;ifstream fin ("humble.in");ofstream fout ("humble.out");int main(){ int k,n,i,j; int s[102],hm[100002],index[102]; for(i=1;i<=101;i++) index[i]=1; fin>>
2012-10-07 15:38:31 233
原创 Score Inflation 完全背包 注释部分是错误的解法
#include#includeusing namespace std;ifstream fin ("inflate.in");ofstream fout ("inflate.out");int x[202];int max(int a,int b){ if(a>b) return a; else return b;}int main()
2012-10-07 15:23:48 493 1
原创 Agri-Net
#include#includeusing namespace std;ifstream fin ("agrinet.in");ofstream fout ("agrinet.out");int main(){ int i,j,n; int p[101][101]; int sign[101]; int sum=0; int t=1; for(i=1;i<=100;i++)
2012-10-05 21:42:50 207
原创 Bessie Come Home
//用dijstra算法找到Z到其余各个顶点的最小距离,然后判断最小距离中离大写字母的顶点中最小的返回#include#include#includeusing namespace std;int maxdist=100000000;int dest[60];int dist[100][100];//a[][]保存各个牧场的距离,不相连就是maxdistint s[60]={0};
2012-10-02 20:33:14 390
原创 The Tamworth Two
题目网址:http://wenku.baidu.com/view/816dfaf29e31433239689324.html#include#includeusing namespace std;int main(){ ifstream fin ("ttwo.in"); ofstream fout ("ttwo.out"); char pos[11][11]={'d'}; int
2012-09-22 13:25:35 247
原创 USACO Controlling Companies
参考网址:http://blog.sina.com.cn/s/blog_62213fa10100g4kx.htmlint main(){ ifstream fin ("concom.in"); ofstream fout ("concom.out"); int flag=1,i,j,k; int company[102][102]={0},total[102][102]={
2012-09-11 20:58:33 197
原创 money system
题目网址:http://wenku.baidu.com/view/816dfaf29e31433239689324.html参考网址:http://blog.sina.com.cn/s/blog_61576de10100sizc.html#includeusing namespace std;ifstream fin ("money.in");ofstream fout ("money.
2012-09-08 20:26:14 266
原创 Zero Sum(DFS算法,后附错误解法,但不知道何处出错)
参考网址:http://www.cnblogs.com/void/articles/2336263.html题目网址:http://wenku.baidu.com/view/816dfaf29e31433239689324.html#include#include using namespace std;int n;ifstream fin ("zerosum.in");ofstre
2012-09-06 21:08:23 640 1
原创 Cow Pedigrees
//题目见:http://wenku.baidu.com/view/816dfaf29e31433239689324.html//每个树的状态都由其左右子树状态决定,根据乘法原理,其状态数等于左右子树状态数乘积#includeusing namespace std;int main(){ ifstream fin ("nocows.in"); ofstream fout
2012-08-31 20:45:18 270
原创 Longest Prefix
题目见:http://wenku.baidu.com/view/816dfaf29e31433239689324.html #include #include using namespace std; int main() { ifstream fin ("prefix.in"); ofstream fout ("prefix.out
2012-08-31 18:21:03 333
原创 mahout在hadoop下安装与测试过程
1.下载mahout-0.5 网址:http://mirror.bjtu.edu.cn/apache/mahout/0.5/2.将压缩文件解压到/home/hadoop/tools/3.在/etc/profile和~/.bashrc中添加: export HADOOP_HOME=/home/hadoop/hadoop-1.0.1 export HADOOP_CONF_DIR=/home/h
2012-08-27 16:19:23 916
原创 Runaround Numbers
#include #includeusing namespace std;char *itoa(int num, char *str, int radix){ //0的情况 if (num==0) { str[0]='0'; str[1]='\0';
2012-08-26 18:37:10 311
原创 Subset Sums,后附深搜算法,当然超时
#includeusing namespace std;int main(){ int sum,n,i,j; ifstream fin ("subset.in"); ofstream fout ("subset.out"); int a[40][391]={0}; // a[i][j]=a[i-1][j] if j<i // a[i][j]=a[i-1
2012-08-26 12:38:04 1342
原创 Healthy Holsteins
#includeusing namespace std;int n;//保存维生素的种类数,n<30int v[30];//每天需要的每种维生素数int m;//保存饲料种类数,m<20int s[20][30];//每种饲料含有的维生素含量int mins=10000;//保存最少的饲料种类数int now_num[30]={0};//保存当前各种维生素的含量,共n个
2012-08-15 21:11:23 278
原创 Sorting A Three-Valued Sequence
#include#includeusing namespace std;int main(){ ifstream fin ("sort3.in"); ofstream fout ("sort3.out"); int i,j; int n ,count=0; int a[1001],number[3]={0}; fin>>n; for(i=1;i<=n;i++) { fi
2012-08-12 12:21:55 221
原创 Ordered Fractions 运行超时啊~
#include#include#include#includeusing namespace std;int myitoa(int data, string* p, int num) { if (p == NULL) { return -1; } if (data < 0) { *p
2012-08-12 11:02:51 413 1
原创 milking cows
#includeusing namespace std;int main(){ int i,j,N,farms[5000][2],start,end,longest_man,longest_no_man; ifstream fin ("milk2.in"); ofstream fout ("milk2.out"); fin>>N; for(i=0;i<N;i++) { fin
2012-08-05 17:06:16 194
原创 broken necklace
#include#include#include#define null NULLusing namespace std;typedef struct list{ char value; struct list * prior; struct list * next;}list;int main(){ ifstream fin ("beads.in"); ofs
2012-08-04 13:48:04 204
原创 Friday the 13th
#includeusing namespace std;int month[12]={31,28,31,30,31,30,31,31,30,31,30,31};bool isleep(int year){ if((year%100!=0 && year%4==0)||(year%400==0)) return true; else return false;
2012-08-02 21:19:36 269
转载 WordCount 实例分析
WordCount运行详解(2)Hadoop WordCount解读对hadoop第一个小程序WordCount的简单解释.
2012-08-02 11:23:58 371
转载 耶鲁大学心态:送给正在奋斗的人
■ 耶鲁大学心态 1、要自信,绝对自信,无条件自信,时刻自信,即使在做错的时候。 2、寂寞空虚无聊的时候看点杂志,听听音乐,没事给自己找事干,可以无益,但不能有害。 3、不要想太多,尤其是负面的想法,定时清除消极思想。 4、学会忘记一些东西,那些痛苦的、尴尬的、懊悔的记忆,为阳光的记忆腾出空间。 5、敢于尝试新事物,敢于丢脸,热爱丢脸,勇于挑战。年轻时多犯几次错误,有
2012-07-25 13:45:29 502
转载 Checker Challenge
#include "stdafx.h" #include #include using namespace std; const int MAX=13; int N; //维数 int count; //计数,保证前三个输出,后面的不输出。 int col[MAX]; ofstream fout; bool check(i
2012-07-22 19:56:40 242
Node.js Design Patterns nodejs设计模式第2版
2018-11-07
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人