自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(40)
  • 资源 (6)
  • 收藏
  • 关注

原创 题目105:单词替换

http://ac.jobdu.com/problem.php?cid=1040&pid=1041、str1.find(str2,pos);   若循环查找,pos+str2.size(),查找完,跳过当前这个位置再查找2、str1.replace(pos1,num,str2); 替换位置,替换个数,目标字符串3、出现TE,因为循环查找处问题#include #include #i

2013-03-18 19:44:40 661

原创 题目1466:排列与二进制

http://ac.jobdu.com/problem.php?pid=1466思路:例:(10,5) 10*9*8*7*6=30240,其二进制,末尾5个0,正好等于,10,9,8,7,6的二进制末尾                    0的个数的和。10的二进制,1010,1个0;8,1000,3个0...优化:1、j%2==0  可以变为:( j&1 )==0

2013-03-17 20:59:14 781

原创 题目1496:数列区间

http://ac.jobdu.com/problem.php?pid=1496超时原因:                正常模拟,极端情况下,第k+1次操作对第k次操作的数字实现了全覆盖,则第k次操作对于最终结果全无意义改善:逆向操作,先进行第k次操作,则第k-1次操作时,为0的数字(后续操作没有再覆盖操作)才进行修改           某大牛使用了next数组,每次修改数字后

2013-03-17 16:07:51 938

原创 题目1493:公约数

http://ac.jobdu.com/problem.php?pid=1493思路:       1、求最大公约数,gcd       2、最大公约数,因式分解,(循环除小于bound的素数)       3、k1个因子1,k2个因子2,k3个因子3...       4、ans=(k1+1)(k2+1)(k3+1)....#include #include #inc

2013-03-17 14:57:37 620

转载 1004. Counting Leaves

师兄的代码,学习了孙佰贵的专栏 1004. Counting Leaves (30)  1、组合类型,queue2、bfs遍历3、邻接表4、注意事项:                        ①、先判断层,是否到了下一层。因为可能会到了下一层刚好是叶子,num++,再判断层,保存num,出错                        ②、退出w

2013-03-15 21:19:48 684

原创 1053. Path of Equal Weight

http://pat.zju.edu.cn/contests/pat-a-practise/1053链表的操作,dfs遍历#include #include #include #include #include using namespace std;struct Node { int weight; vector next; //节点的孩子向量,保存nod

2013-03-15 19:44:13 683

原创 hdu_1062:Text Reverse

http://acm.hdu.edu.cn/showproblem.php?pid=1062#include #includeint main(){ int n,i,j,flag; char str[1000]; while (scanf("%d",&n)!=EOF) { getchar(); while (n--) { gets(str); fla

2013-03-12 11:28:25 531

原创 hdu_1020:Encoding

http://acm.hdu.edu.cn/showproblem.php?pid=1020#include #includechar str[10005]; //输入的字符串int a[26]; //标记26个字母的个数 int main() { int n,i,flag;

2013-03-12 10:35:46 543

原创 hdu_1201:18岁生日

http://acm.hdu.edu.cn/showproblem.php?pid=1201#include int isyear(int x){ if ( (x%400==0)||(x%100!=0&&x%4==0) ) { return 1; } else return 0;}int dayofmonth[13][2]={ 0,0, 31,

2013-03-12 09:48:55 573

原创 1051.Pop Sequence

http://pat.zju.edu.cn/contests/pat-a-practise/1051#include #include #include using namespace std;stack ans;int a[1005],b[1005];int main(){ int m,n,k,i; while (scanf("%d%d%d",&m,&n,&k)!=EO

2013-03-11 10:51:55 535

原创 zju2010:ZOJ问题

http://ac.jobdu.com/problem.php?pid=10062010年浙江大学计算机及软件工程研究生机试真题#include char str[1005];int main(){ int a,b,c,z,j,i; //a:z前面o的个数,b:zj间o的个数,c:j后面o的个数 while (scanf("%s",s

2013-03-11 09:47:36 462

原创 九度题目1099:后缀子串排序

http://ac.jobdu.com/problem.php?pid=10992010年上海交通大学计算机研究生机试真题1、每轮测试都要清空容器2、substr的使用#include #include #include #include using namespace std;vector ans;int main(){ string s,tmp;

2013-03-10 17:52:51 529

原创 九度题目1097:取中值

http://ac.jobdu.com/problem.php?pid=10971、不用真的拿出来,合并,再找中间下标的值2、注意下标计算,相对起始坐标。而并不一定是相对1开始的#include int a[1000005];int b[1000005];int main(){freopen("D:\\1.txt","r",stdin); int t,n,m,i,j;

2013-03-10 17:10:40 644

原创 zju2011 Median

http://ac.jobdu.com/problem.php?pid=1004#include int a[1100005],b[1100005];int main(){ int n,m,i,j,num,mid,ans; while (scanf("%d",&n)!=EOF) { for (i=0;i<n;i++) { scanf("%d",&a[i]);

2013-03-10 16:06:13 458

原创 九度题目36:二叉搜索树(判断是否是相同二叉搜索树)

http://ac.jobdu.com/problem.php?cid=1040&pid=352010浙江大学计算机机试试题1、两个二叉树相同:插入建树,先序遍历+中序遍历=一个字符串                              比较两次得到的字符串,若相同才是相同二叉搜索树 2、两次遍历时,通过指针操作相应字符串,指针每次重定向到相应字符串的首地址

2013-03-09 21:45:34 602

原创 1042. Shuffling Machine

http://pat.zju.edu.cn/contests/pat-a-practise/1042#include int card[55]; //有序牌int order[55]; //特定顺序int tmp[55]; //暂存中间变换结果 ch

2013-03-09 20:29:43 571

原创 题目96:拦截导弹

http://ac.jobdu.com/problem.php?cid=1040&pid=95最长递增子序列:                  f(1)=1;                  f(i) = max { 1 , f(j)+1 | aj 最长递增不减序列:                  f(1)=1;                  f(i) =

2013-03-09 16:26:10 564

原创 题目94:不容易系列之一

http://ac.jobdu.com/problem.php?cid=1040&pid=93错排公式:f(n) = (n-1) * f(n-1) + (n-1) * f(n-2)  #include long long a[21];int main(){ a[1]=0; a[2]=1; int i,n; for (i=3;i<=20;i++) /

2013-03-09 15:31:06 438

原创 题目93:N阶楼梯上楼问题

http://ac.jobdu.com/problem.php?cid=1040&pid=92基础动态规划题思考最后一步,要么上一阶,要么上两阶,所以f(n)=f(n-1)+f(n-2)#include long long a[90];int main(){ int n,i; while (scanf("%d",&n)!=EOF) { a[1]=1;

2013-03-09 15:19:03 668

原创 题目1167:数组排序

http://ac.jobdu.com/problem.php?pid=11672009年北京航空航天大学计算机研究生机试真题#include #include #include using namespace std;struct E { int no; int data; int order;}buf[10005];bool cmp1(E A,E B){

2013-03-09 12:58:59 667

原创 题目1165:字符串匹配

http://ac.jobdu.com/problem.php?pid=11652008年北京航空航天大学计算机研究生机试真题#include #include #include #include using namespace std;string a[1005],A[1005]; //a保存输入的字符串,A保存转换为大写后的字符串string tmp,pre

2013-03-09 10:41:39 741

原创 题目1174:查找第K小数

http://ac.jobdu.com/problem.php?pid=11742010年北京邮电大学网院研究生机试真题#include #include #include using namespace std;int a[1005];int main(){ int n,i,k; while (scanf("%d",&n)!=EOF) { for (i=0;i<

2013-03-08 23:14:53 517

原创 九度题目1175:打牌

http://ac.jobdu.com/problem.php?pid=11752010年北京邮电大学网院研究生机试真题#include #include char a[105],b[105];int count[10]; //统计a中出现牌的个数,1几张,2几张int main(){//freopen("D:\\1.txt","r",stdin); i

2013-03-08 23:07:56 724

原创 hdu1575:Tr A_矩阵的幂&二分求幂

http://acm.hdu.edu.cn/showproblem.php?pid=1575二维矩阵做参数,写在结构体里,优化;#include #include struct Matrix { int m[12][12];}a,b,c;int n,m,i,j,k;Matrix deal(Matrix a,Matrix b) //基本的矩阵乘法

2013-03-08 22:13:29 565

原创 题目1203:IP地址

http://ac.jobdu.com/problem.php?pid=12032006年华中科技大学计算机保研机试真题全部判断完毕再输出#include #include int main(){ freopen("D:\\1.txt","r",stdin); int x,n,i; char ch; while (scanf("%d",&n)!=EOF) { wh

2013-03-08 16:59:45 661

原创 题目1199:找位置

http://ac.jobdu.com/problem.php?pid=11992005年华中科技大学计算机保研机试真题1、注意一些细节,逗号的处理;换行的处理;第一次检测到与之后检测到相同字符的不同处理2、#include #include int main(){ //freopen("D:\\1.txt","r",stdin); int i,j; char s

2013-03-08 16:39:52 646

原创 九度题目1182:统计单词

http://ac.jobdu.com/problem.php?pid=11822002年华中科技大学计算机研究生机试真题将输入一行字符串转为单个输入单词,每次输出个数,若最后一个字符是.则结束本行输入熟悉双重while循环的输入方式#include #include char str[1000];int main(){freopen("D:\\1.txt","r",

2013-03-08 15:40:09 530

原创 九度题目1184:二叉树遍历

http://ac.jobdu.com/problem.php?pid=11842002年华中科技大学计算机研究生机试真题ABC##DE#G##F###先序建树:a ,左孩子b。                  b,左孩子c,                  c,左孩子空,右孩子空,退回b                  b,右孩子d

2013-03-08 15:22:58 959

原创 九度&题目1180:对称矩阵

http://ac.jobdu.com/problem.php?pid=11802000年华中科技大学计算机研究生机试真题#include #include #include #include using namespace std;int a[105][105];int main(){freopen("D:\\1.txt","r",stdin); int n

2013-03-08 14:39:41 645

原创 九度题目1179:阶乘

http://ac.jobdu.com/problem.php?pid=11792000年华中科技大学计算机研究生机试真题不涉及大数,所以简单阶乘就好,结果保存在long long 型数据#include #include #include #include using namespace std;long long JIEC(long long x){ if

2013-03-08 14:30:44 555

原创 九度&1195:最长&最短文本

http://ac.jobdu.com/problem.php?pid=1195#include #include #include #include using namespace std;struct E { char a[1005]; int len;}buf[1000];int main(){// freopen("D:\\1.txt","r

2013-03-08 14:19:05 825

原创 zju2011保研:Twin Prime Conjecture

http://acm.hdu.edu.cn/showproblem.php?pid=3792浙大计算机研究生保研复试上机考试-2011年1、素数筛法2、一次得到所有n以下的孪生素数数目保存在数组里,否则,每次输入n,在判断会超时#include #include int prime[100000];bool mark[100000];int p[100000];in

2013-03-06 13:35:11 617

原创 zju2012:Hello World for U

http://ac.jobdu.com/problem.php?pid=14642012年浙江大学计算机及软件工程研究生机试真题#include #include char str[100];char a[100][100];int main(){ int i,j,n1,n2,n3,k; while (scanf("%s",str)!=EOF) { in

2013-03-05 19:18:01 694

原创 zju2011:grade

http://ac.jobdu.com/problem.php?pid=10022011年浙江大学计算机及软件工程研究生机试真题1、fabs------求浮点数的绝对值2、求几个值得最大值的小技巧,max函数嵌套#include #include double max1(double a,double b){ return a>b?a:b;}double

2013-03-05 14:39:06 525

原创 热身赛ZJU2008:看病要排队

http://acm.hdu.edu.cn/showproblem.php?pid=18732008浙大研究生复试热身赛(2)——全真模拟注意:1、in 与 out 之后输入个数不同,所以先分辨再输入%d%d或%d          2、优先级相同的,按时间先后确定,所以用stable_sort;#include #include #include #in

2013-03-04 17:28:35 438

原创 热身赛zju2008:稳定排序

http://acm.hdu.edu.cn/showproblem.php?pid=18722008浙大研究生复试热身赛(2)——全真模拟#include #include #include using namespace std;struct STU { char no[100]; int score;};STU buf[305],tmp[305];b

2013-03-04 16:29:51 345

原创 热身赛zju2008:找旅馆_hdu1871

http://acm.hdu.edu.cn/showproblem.php?pid=18712008浙大研究生复试热身赛(2)——全真模拟#include #include #include using namespace std;struct E { int no; int num; int price;}buf[1000];bool cmp(E A,

2013-03-04 15:48:14 460

原创 zju2009_继续xxx定律

http://acm.hdu.edu.cn/showproblem.php?pid=3784浙大计算机研究生复试上机考试-2009年#include #include bool visit[1000001]; //中间可能有很大的数int b[501];int main(){ int n,i; while (scanf(

2013-03-03 19:05:32 333

原创 zju2009:ZOJ

http://acm.hdu.edu.cn/showproblem.php?pid=3783浙大计算机研究生复试上机考试-2009年字符只有zoj,所以将字符串输出,转为统计多少个字符,按相应顺序输出相应字符即可#include #include int main(){ char str[120]; while (scanf("%s",str)!=EOF&&str

2013-03-03 17:28:41 358

原创 zju2009:xxx定律

http://acm.hdu.edu.cn/showproblem.php?pid=3782浙大计算机研究生复试上机考试-2009年#include int main(){ int n,t; while (scanf("%d",&n)&&n!=0) { int ans=0; while (n!=1) { if (n%2==0) { n

2013-03-03 17:13:03 262

电路分析习题解答 高等教育出版社

郑州大学电路分析,高等教育出版社出版的教材,本书是习题解答

2010-12-09

《UNIX操作系统设计》

《UNIX操作系统设计》,机械工业出版社,陈宝玉作品,是学习unix的经典入门翻译作品 pdf 格式

2010-07-26

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除