上一页 1 2 3 4 5 6 7 ··· 13 下一页
摘要: http://poj.org/problem?id=2000View Code #include<stdio.h>int main(){ int n, i ; int a[10010]={0}, days=0, coins=1; while(days<10000) { i = coins ; while(i--) { days++ ; a[days] = a[days-1] + coins ; if(days==10000) break ; ... 阅读全文
posted @ 2013-04-10 18:03 yelan@yelan 阅读(145) 评论(0) 推荐(0) 编辑
摘要: http://poj.org/problem?id=1218开关门问题,初始化门(编号1~n)都是关着的,改变状态为开变关、关变开: 第1遍,全部改变状态;第2遍,编码2的倍数的门改变状态; 第3遍,编码3的倍数的门改变状态……第n遍,编码n的倍数的门改变状态;结束后,有多少扇门是开着的法一:View Code 1 #include<stdio.h> 2 #include<string.h> 3 int main() 4 { 5 int t, n, i, j ; 6 int a[110] ; 7 scanf("%d", &t) ; 8 whi 阅读全文
posted @ 2013-04-10 14:57 yelan@yelan 阅读(166) 评论(0) 推荐(0) 编辑
摘要: http://poj.org/problem?id=2017View Code #include<stdio.h>int main(){ int n, s, t, i, f, sum ; while(scanf("%d", &n)!=EOF) { if(n==-1) break ; sum = 0 ; f = 0 ; for(i=1; i<=n; i++) { scanf("%d %d", &s, &t) ; sum += s*(t - f) ; ... 阅读全文
posted @ 2013-04-10 13:41 yelan@yelan 阅读(160) 评论(0) 推荐(0) 编辑
摘要: http://acm.hdu.edu.cn/showproblem.php?pid=1710C:不要在for循环内定义变量,在函数开始处定义变量View Code #include<stdio.h>#include<string.h>#include<malloc.h>typedef struct tree{ int data ; struct tree *l, *r ;}tree, *tr ;int flag ;tr creat(int *root, int*in, int k){ tr t ; int *p ,m; if(k<=0) return 阅读全文
posted @ 2013-04-01 20:24 yelan@yelan 阅读(188) 评论(0) 推荐(0) 编辑
摘要: http://poj.org/problem?id=1577View Code #include <stdio.h>#include <string.h>#include <malloc.h>typedef struct BiTree{ char ch; struct BiTree *lchild; struct BiTree *rchild;}BiTree;BiTree *createBiTree(char ch){ BiTree *leaf = (BiTree *)malloc(sizeof(BiTree)); leaf->ch = ch; lea 阅读全文
posted @ 2013-04-01 20:11 yelan@yelan 阅读(168) 评论(0) 推荐(0) 编辑
摘要: http://poj.org/problem?id=1035View Code #include<cstdio>#include<cstring>#include<algorithm>using namespace std;struct node{ char str[20]; int index;}ans[10010];struct Trie{ Trie *br[26]; int index; void init() { index=0; for(int i=0;i<26;++i) br[i]=NULL; ... 阅读全文
posted @ 2013-04-01 20:05 yelan@yelan 阅读(147) 评论(0) 推荐(0) 编辑
摘要: http://poj.org/problem?id=2418View Code #include<stdio.h>#include<malloc.h>#include<string.h>char s[31] ;int sum = 0 ;struct BiTree{ int num ; char species[31] ; BiTree *l, *r ;} ;BiTree *t ;BiTree *creat(){ BiTree *p ; p = (struct BiTree*)malloc(sizeof(struct BiTree)) ; p->l = 阅读全文
posted @ 2013-04-01 19:55 yelan@yelan 阅读(239) 评论(0) 推荐(0) 编辑
摘要: http://poj.org/problem?id=2001View Code #include<stdio.h>#include<string.h>#include<malloc.h>struct trie{ bool isstr ; int num ; trie *next[26] ;} ;void insert(trie *root, char *s){ int i ; if(root==NULL||*s=='\0') return ; trie *p = root ; while(*s) { if(p->next[*s... 阅读全文
posted @ 2013-04-01 19:34 yelan@yelan 阅读(154) 评论(0) 推荐(0) 编辑
摘要: http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemCode=36310MS:View Code 1 #include<stdio.h> 2 #include<algorithm> 3 using namespace std ; 4 int a[31] ; 5 int n, m, ans ; 6 void dfs(int i, int v) 7 { 8 if(ans==m) 9 return ;10 if(v>m)11 return ;12 if(i<1)13 {14 ... 阅读全文
posted @ 2013-03-31 21:31 yelan@yelan 阅读(246) 评论(0) 推荐(0) 编辑
摘要: http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemCode=3622View Code 1 #include<iostream> 2 using namespace std ; 3 long long f[55] = {1,2,5,10,20,25,50,100,125,200,250,500,1000,1250,2000,2500, 4 5000,10000,12500,20000,25000,50000,100000,125000,200000,250000,500000,1000000, 5 1250000,200 阅读全文
posted @ 2013-03-31 20:35 yelan@yelan 阅读(171) 评论(0) 推荐(0) 编辑
上一页 1 2 3 4 5 6 7 ··· 13 下一页