基础算法-分治-递归-枚举-贪心-模拟。。。
文章平均质量分 72
码码要洗手
我很重要
展开
-
A公司的烦恼-贪心
因为一个公司的每一个月是既有盈利,又有亏损的,所以可以先求出至少有多少个月是亏损的。然后根据亏损的月运用贪心思想。如i == 4 则必然12个月的情况为 sddddsddddsd 而且还有判断3*S-9*D>=0? 如果都满足,则有最大盈利。否则无。 i ==3 ssdddssdddss.i==2 sssddsssddssi==1 ssssdssssdss.原创 2014-02-16 14:22:28 · 848 阅读 · 0 评论 -
hdu find the nth digit(1597)
find the nth digitTime Limit: 1000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 8358 Accepted Submission(s): 2385Problem Description假设:S1 = 1S2 =原创 2014-08-13 20:42:50 · 479 阅读 · 0 评论 -
hdu find a way to escape(1593)
find a way to escapeTime Limit: 1000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 1390 Accepted Submission(s): 509Problem Description一日,话说0068与***泛舟湖原创 2014-08-13 19:46:22 · 578 阅读 · 0 评论 -
hdu find the max(1594)
find the maxTime Limit: 1000/1500 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 613 Accepted Submission(s): 286Problem Description有一个离散函数f(x),x = {1, 2, ,,原创 2014-08-13 20:17:50 · 601 阅读 · 0 评论 -
hdu Yukari's Birthday (4430)
Yukari's BirthdayTime Limit: 12000/6000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 2910 Accepted Submission(s): 610Problem DescriptionToday is Yuk原创 2014-09-07 10:10:24 · 549 阅读 · 0 评论 -
HDU1425_sort
题目大意:给你 n 个整数,按顺序输出原创 2014-07-22 21:15:43 · 408 阅读 · 0 评论 -
再次计数问题
题目大意:给定你原创 2014-07-23 10:40:41 · 562 阅读 · 0 评论 -
HDU1496_Equations
题目大意:给你一个方程式:a*x1^2+b*x2^2+c*x3^2+d*x4^2=0原创 2014-07-22 21:32:07 · 384 阅读 · 0 评论 -
POJ2109_ Power of Cryptography
题目大意:给你两个数,原创 2014-07-21 20:53:45 · 442 阅读 · 0 评论 -
Ranking System
Pierre is recently obsessed with an online game. To encourage users to log in, this game will give users a continuous login reward. The mechanism of continuous login reward is as follows: If you have原创 2014-05-25 12:25:25 · 556 阅读 · 0 评论 -
Poj 3262 Protecting the flowers
Protecting the FlowersTime Limit: 2000MS Memory Limit: 65536KTotal Submissions: 3629 Accepted: 1490DescriptionFarmer John went to cut some wood and left N (2 ≤原创 2014-03-08 18:14:13 · 624 阅读 · 0 评论 -
Radar Installation
Radar InstallationTime Limit: 1000MS Memory Limit: 10000KTotal Submissions: 47289 Accepted: 10555DescriptionAssume the coasting is infinite straight line. Land原创 2014-03-08 19:33:00 · 504 阅读 · 0 评论 -
背包问题的递归与非递归求解
对于递归转到非递归问题 ,一般都是 自己构造一个栈。/*#includeint knap(int w[],int v,int n){ if(v == 0) return 1; else{ if(v 0 && n<1)) return 0; else{ if(knap(w,v-w[n-1],n-1)==1){原创 2014-03-06 10:47:04 · 731 阅读 · 0 评论 -
约瑟夫环
就是循环链表的应用 。#include#include#includetypedef struct point{ int data; int num; struct point *next;}LNode,*LinkList;int n,m;LinkList create(){ int i; LinkList head,tai原创 2014-03-06 10:16:05 · 503 阅读 · 0 评论 -
木棒三角形-枚举
点击打开链接因为长度是从小到大输入的,而且木棒的条数最大不会超过100 ,所以可以直接枚举。#includeint main(){ int n; int i,j,k; double ans; double a[110]; while(scanf("%d",&n)!=EOF){ ans = -1;原创 2014-02-16 14:04:31 · 894 阅读 · 0 评论 -
汉诺塔-递归
题目很简单。#includevoid Move(int n,char x,char y){ printf("move %d from %c to %c\n",n,x,y);}void Hannoi(int n,char a,char b,char c){ if(n==1) Move(1,a,c); else { Hannoi(n-1,a原创 2014-02-16 13:55:06 · 482 阅读 · 0 评论 -
计数问题-分治
要求出a,b两个数中1出现的次数,可以先求出大者出现的1 的个数,然后求出小者1出现的个数,两者相减即可。以0,197为例 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 3原创 2014-02-16 13:45:28 · 574 阅读 · 0 评论 -
UESTC 893 First Date 计算时间
First DateTime Limit: 5678/1234MS (Java/Others) Memory Limit: 65432/65432KB (Java/Others)Submit StatusIn 1582, pope Gregory XIII decreed a calendar reform to bring the mean l原创 2014-08-31 22:30:44 · 559 阅读 · 0 评论