摘要: 题目:给你一组数,求出其中两两最大公约数中最大的值 解析:数论,小数据直接枚举。 坑点:输入,可能有多余空格,TL问题 #include<iostream> #include<cstdio> #include<cstring> #include<cmath> #include<map> using 阅读全文
posted @ 2020-03-09 16:31 liyexin 阅读(137) 评论(0) 推荐(0)
摘要: 题意:根据第一段,只是让你找到任意一组元素,和为偶数即可。还可以根据OUTPUT最后一句,多种答案,输出任意一种。 解析:随便找嘛,所以如果碰到单个偶数,直接输出,否则找出任意两个奇数输出即可。都没有,就输出-1. #include<iostream> #include<cstdio> #inclu 阅读全文
posted @ 2020-03-08 23:52 liyexin 阅读(178) 评论(0) 推荐(0)
摘要: C - Matrix Chain Multiplication(Stack应用) There is a famous railway station in PopPush City. Country there is incredibly hilly. The station was built i 阅读全文
posted @ 2020-03-05 23:16 liyexin 阅读(169) 评论(0) 推荐(0)
摘要: 地址:http://codeforces.com/contest/1305 题意:A题写这么长,实际上意思很简单,给出两组长度相等的数,让你给出排列顺序,保证每一列上下加起来不同。 解析:很水了,小+大=大+小,根据这个,只要上下均按从小到大的顺序排列就可以了。 #include<cstdio> # 阅读全文
posted @ 2020-03-05 23:14 liyexin 阅读(174) 评论(0) 推荐(0)
摘要: 题目链接:https://onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&problem=3593 题意:输入n*4的矩阵,从4列中每个选一个数求有多少个和为0; 1 6 -45 22 42 -1 阅读全文
posted @ 2020-02-29 00:12 liyexin 阅读(172) 评论(0) 推荐(0)
摘要: BackgroundStacks and Queues are often considered the bread and butter of data structures and find use in architecture, parsing, operating systems, and 阅读全文
posted @ 2020-02-27 23:23 liyexin 阅读(180) 评论(0) 推荐(0)
摘要: Description Professor Dumbledore is helping Harry destroy the Horcruxes. He went to Gaunt Shack as he suspected a Horcrux to be present there. He saw 阅读全文
posted @ 2020-02-20 23:25 liyexin 阅读(287) 评论(0) 推荐(0)
摘要: http://codeforces.com/contest/1301 Dark is going to attend Motarack’s birthday. Dark decided that the gift he is going to give to Motarack is an array 阅读全文
posted @ 2020-02-17 18:08 liyexin 阅读(248) 评论(0) 推荐(0)
摘要: https://www.51nod.com/Challenge/Problem.html#problemId=1267 第一种方法:两个for+二分:很好理解,不用考虑重复的问题。但是这个还不够快 #include<iostream> #include<cstdio> #include<cstrin 阅读全文
posted @ 2020-02-16 23:47 liyexin 阅读(224) 评论(0) 推荐(0)
摘要: http://codeforces.com/contest/1303 A: 第一题给一个只有01的字符串,操作是可以删除0,结果要保证1都是挨着的。问最小操作数。 解析:特判,len=1是直接输出0。其他的就是找到第一个为1而且下一位为0的位置,以此往下找,找到第一个为1而且j!=i+1就可以了,减 阅读全文
posted @ 2020-02-14 00:24 liyexin 阅读(236) 评论(0) 推荐(0)