随笔分类 - 其他---思维
摘要:题目:http://codeforces.com/contest/1189/problem/D1 题意:给定一棵树,可以选择任意两个叶子节点对他们的路径增加一定的权值。 问对于给定的这棵树,是否可以得到任意形式的权值。 思路: 只要有一个节点的度是2,那么这个节点连接的某一条边一定受到另一条边的控制
阅读全文
摘要:题目:http://codeforces.com/contest/1189/problem/C 题意:给定n个数,每次查询一个区间[l,r]。对这个区间内的数,相邻两个数之和超过10,则得到一个candy,然后将他们之和取模10的结果作为新的数。 一共操作l−r次,问这个区间得到的candy
阅读全文
摘要:题目:https://www.luogu.org/problemnew/show/P1088 题意: 给定一个n个数的排列,要求得到这之后的第m个排列。 思路: next_permutation的简单应用。 题意本身是说找到m加上当前值之后在火星人的表示法里的数。 但是本身加减顺序是可换的,题意可以
阅读全文
摘要:题目:https://www.luogu.org/problemnew/show/P1403 题意: 定义f(n)为n的因子个数。给定一个数n,求f(1)到f(n)之和。 思路: 最直接的想法就是我们求出每一个f的值,然后求和。 但是如果我们转换一个思路,把f的值打散来求,就很简单了。
阅读全文
摘要:A Ehab and another constriction problem https://codeforc.es/contest/1088/problem/A 题意:给定一个数x找两个在1~x之间的数a和b,b是a的因子,$a*b > x, \frac{a}_{b}
阅读全文
摘要:1059A Cashier http://codeforces.com/contest/1059/problem/A 题意: Vasya每天工作l个小时,每天服务n个顾客,每个休息时长是a。给定n个客人来的时间和时长。问Vasya可以休息多长时间。 思路: 先给客人排
阅读全文
摘要:1076A Minimizing the String【字符串】 http://codeforces.com/contest/1076/problem/A 题意: 删掉字符串中的一个字符使得得到的字符串是字典序最小的一种。 思路: 从头到尾找到第一个字符他比他后面的一个字典序要大,那就是要删掉的。
阅读全文
摘要:A The King's Race http://codeforces.com/contest/1075/problem/A 题意: 一个人在(1,1), 一个人在(n,n), 现在他们每次轮流走一步,问谁先到达(x,y) 思路: 每个人走到(x,y)的步数是可以直接
阅读全文
摘要:A Birthday http://codeforces.com/contest/1068/problem/A 题意: 有n种硬币,m个人。m个人要给Ivan送硬币,每个人送的硬币都要互不相同但数量一样。Ivan现在已经有k种了,具体哪k种不知道。现在要求朋友们送的硬币至少有l种是IVan没有的。
阅读全文
摘要:Kadj Squares Time Limit: 2000MS Memory Limit: 65536K Total Submissions: 3594 Accepted: 1456 Description In this problem, you are given a sequence S1,
阅读全文
摘要:Given a collection of number segments, you are supposed to recover the smallest number from them. For example, given { 32, 321, 3214, 0229, 87 }, we c
阅读全文
摘要:There is a classical process named partition in the famous quick sort algorithm. In this process we typically choose one element as the pivot. Then th
阅读全文
摘要:A golden plate http://codeforces.com/contest/1072/problem/A 题意:给一个n*m的格子,从最外层往里涂色,每次尽量涂最外面的那一圈,两圈涂色之间要间隔一格。问最多涂多少颜色。 思路:最外面一圈是2*n + 2(m - 2),然后行和列都减4就
阅读全文
摘要:A Make a triangle! http://codeforces.com/contest/1064/problem/A 题意: 给定三个整数表示三角形的边。每次给边长可以加一,问至少要加多少才能使这三个边成为一个三角形。 思路: 找到最大的边,然后最大边 + 1减剩下两条边就行了。负数的话就
阅读全文
摘要:C. Plasticine zebratime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputIs there anyth...
阅读全文
摘要:链接:https://www.nowcoder.com/acm/contest/145/J来源:牛客网 时间限制:C/C++ 1秒,其他语言2秒空间限制:C/C++ 32768K,其他语言65536KSpecial Judge, 64bit IO Format: %l...
阅读全文