随笔分类 -  水题

不能主动做水题
摘要:Problem A 题意:开局:1A 两种操作: 1A->xA,yA->1B,问最少多少次操作能获得kA和kB 思路:1A->xA这个操作增加了x-1 A 要获得kB,那肯定需要y* kA + k个操作 所以总共需要(y+1) * k个A,这些需要 ceiling(((y + 1) * k - 1) 阅读全文
posted @ 2020-09-17 22:34 雪溯 阅读(201) 评论(0) 推荐(0) 编辑
摘要:题目 https://icpcarchive.ecs.baylor.edu/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&problem=2637 题意 积木,有左视图和前视图,问最少几块积木 思路 明显,把前视图视作列,左视 阅读全文
posted @ 2019-04-12 22:21 雪溯 阅读(155) 评论(0) 推荐(0) 编辑
摘要:题目 https://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&problem=2384 题意 n个司机,n个白天路线,n个晚上路线,要求每个司机一个白天一个晚上路线。设司机2个路线 阅读全文
posted @ 2019-04-08 21:19 雪溯 阅读(102) 评论(0) 推荐(0) 编辑
摘要:题目 https://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&problem=1323 题意 长方形l * w,给出长方形中间那条线上n个圆的圆心c和半径r,选取最少数目的圆覆盖长 阅读全文
posted @ 2019-03-02 22:25 雪溯 阅读(107) 评论(0) 推荐(0) 编辑
摘要:题目 https://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&problem=1281 题意 问字符串a能否是字符串b的子序列 思路 明显,计数对的上就行 感想 因为忘了break 阅读全文
posted @ 2019-03-02 21:31 雪溯 阅读(98) 评论(0) 推荐(0) 编辑
摘要:题目 https://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&category=0&problem=1911 题意 m*n的矩形巧克力,要切成1*1,不能一次切两块,问多少下切完 阅读全文
posted @ 2019-03-02 21:17 雪溯 阅读(80) 评论(0) 推荐(0) 编辑
摘要:题目 https://icpcarchive.ecs.baylor.edu/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&problem=1603 题意 问使m个n长碱基序列汉明码最小的序列 思路 明显,取最频繁的 代码 #i 阅读全文
posted @ 2019-03-02 20:47 雪溯 阅读(81) 评论(0) 推荐(0) 编辑
摘要:题目 https://icpcarchive.ecs.baylor.edu/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&problem=1214 题意 问字符串a能否是字符串b经过某种替换+移位密码的密文 思路 明显,计数对 阅读全文
posted @ 2019-03-01 17:23 雪溯 阅读(105) 评论(0) 推荐(0) 编辑
摘要:题目 https://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&problem=1980 题意 n个数,要求正负相间,绝对值增长,问n个数能组成的这样数列最长多长 思路 明显,分成正 阅读全文
posted @ 2019-02-27 11:45 雪溯 阅读(80) 评论(0) 推荐(0) 编辑
摘要:题目 https://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&problem=2683 题意 原来有1个,每次可以任选数量成倍增长,问要操作多少次到n 思路 明显,先扩增到最大数位 阅读全文
posted @ 2019-02-26 17:08 雪溯 阅读(100) 评论(0) 推荐(0) 编辑
摘要:题目 http://poj.org/problem?id=1837 题意 单组数据,有一根杠杆,有R个钩子,其位置hi为整数且属于[-15,15],有C个重物,其质量wi为整数且属于[1,25],重物与重物之间,钩子与钩子之间彼此不同。忽略杠杆及重心的影响,有多少种方式使得全部重物都挂上钩子(某些钩 阅读全文
posted @ 2017-03-28 07:32 雪溯 阅读(199) 评论(0) 推荐(0) 编辑
摘要:题目 http://poj.org/problem?id=3126 题意 多组数据,每组数据有一个起点四位数s, 要变为终点四位数e, 此处s和e都是大于1000的质数,现在要找一个最短的路径把s变为e,每步可以做如下操作,把当前的s中的四位数上的某一位改变,比如1009可以变为2009,1008, 阅读全文
posted @ 2017-02-14 18:52 雪溯 阅读(217) 评论(0) 推荐(0) 编辑
摘要:题目 http://poj.org/problem?id=2002 题意 已知平面内有1000个点,所有点的坐标量级小于20000,求这些点能组成多少个不同的正方形。 思路 如图,将坐标按照升序排列后,首先枚举p1,p2, 并判断p2是否在p1正下方或者左上角(因为每个正方形只有一条最右边或者是右下 阅读全文
posted @ 2017-02-10 15:33 雪溯 阅读(214) 评论(0) 推荐(0) 编辑
摘要:题目 http://poj.org/problem?id=1840 题意 给 与数组a[5],其中-50<=a[i]<=50,0<=i<5,求有多少组不同的x[5],使得a[0] * pow(x[0], 3) + a[1] * pow(x[1], 3) + a[2] * pow(x[2], 3) + 阅读全文
posted @ 2017-02-09 15:38 雪溯 阅读(181) 评论(0) 推荐(0) 编辑
摘要:题目 http://poj.org/problem?id=1936 题意 多组数据,每组数据有两个字符串A,B,求A是否是B的子串。(注意是子串,也就是不必在B中连续) 思路 设置计数器cnt为当前已匹配A的长度,明显在扫描B的过程中只需要记住cnt这一个状态。 扫描B,每次与A[cnt]匹配就将计 阅读全文
posted @ 2017-02-07 19:03 雪溯 阅读(149) 评论(0) 推荐(0) 编辑
摘要:https://leetcode.com/problems/bitwise-and-of-numbers-range/[n,m]区间的合取总值就是n,m对齐后前面一段相同的数位的值比如5:1017:111结果就是4:100class Solution {public: int rangeBit... 阅读全文
posted @ 2015-08-27 19:27 雪溯 阅读(175) 评论(0) 推荐(0) 编辑
摘要:https://leetcode.com/problems/add-two-numbers/You are given two linked lists representing two non-negative numbers. The digits are stored in reverse o... 阅读全文
posted @ 2015-08-27 10:45 雪溯 阅读(149) 评论(0) 推荐(0) 编辑
摘要:https://leetcode.com/problems/two-sum/class Solution {public: vector twoSum(vector& nums, int target) { vector index(2,0); vector n2;... 阅读全文
posted @ 2015-08-25 18:12 雪溯 阅读(134) 评论(0) 推荐(0) 编辑
摘要:https://leetcode.com/problems/length-of-last-word/int lengthOfLastWord(char* s) { int ans = 0; int fans = 0; for(int i = 0;s[i];i++){ ... 阅读全文
posted @ 2015-08-25 16:48 雪溯 阅读(100) 评论(0) 推荐(0) 编辑
摘要:https://leetcode.com/problems/excel-sheet-column-number/class Solution {public: int titleToNumber(string s) { int ans = 0; for(int i ... 阅读全文
posted @ 2015-08-25 16:40 雪溯 阅读(111) 评论(0) 推荐(0) 编辑

点击右上角即可分享
微信分享提示