摘要: InputThere will be several test cases; each case input contains two integers N and M, which satisfy the relationship: 1 #includeint main(){ int m,n,r=1; while(scanf("%d%d",&m,&n)!=0&&(m!=-1||n!=-1)){ while(m%n!=0){ r=m%n; m=n; n=r;} if(n==1) printf("YES\n"); else 阅读全文
posted @ 2014-02-16 20:03 漏网的鱼 阅读(191) 评论(0) 推荐(0) 编辑
摘要: 思想核心是如何维护一个单调队列,合理应用单调队列简化问题下面是摘抄:单调队列及其应用原创是我可敬的师傅,搜索到的上面那个应该就是原文. 单调队列及其应用 单调队列,望文生义,就是指队列中的元素是单调的。如:{a1,a2,a3,a4……an}满足a1mid do dec(j); 21 if ij; 30 if i>2;//保证程序在需要的地方停止,由于要选极小值 40 sort(1,n); 41 a[n+1]:=maxlongint>>2;//作用同上 42 a[n+2]:=maxlongint>>2; 43 h1:=1; 44 h2:=1; 45 t2:=0... 阅读全文
posted @ 2014-02-16 16:25 漏网的鱼 阅读(229) 评论(0) 推荐(0) 编辑
摘要: 如杭电acm题目The input contains several test cases. The first line of the input is a single integer T which is the number of test cases. T test cases follow. Each test case contains a single line with several words. There will be at most 1000 characters in a line.OutputFor each test case, you should outp 阅读全文
posted @ 2014-02-16 16:21 漏网的鱼 阅读(175) 评论(0) 推荐(0) 编辑