D. Ability To Convert time limit per test 1 second Cmemory limit per test 256 megabytes input standard input output standard output Alexander is learning how to convert numbers from the decimal system to any other, however, he doesn't know English le…
D - Ability To Convert 题目大意:给你一个数字 n 接下来再输入一个数字 w(<10^60),表示w这个数字是 n 进制的, 并且超过十进制也用数字表示,这样就有多种组合了,问你所有组合中(划分方案中)原来的 数字十进制最小是多少. 思路:网上说可以用贪心做,但是我感觉那个贪心比较奇怪,不是很理解,还是用dp靠谱. 用dp[ i ] 表示从到第 i 个数字为止,最小十进制数最小是多少. 初始状态 dp[ 0 ]=0.然后我们枚举起点向后更新. #include<bits/…
D. Ability To Convert time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output Alexander is learning how to convert numbers from the decimal system to any other, however, he doesn't know English let…
orz 最近被水题卡+FST,各种掉rating 题目大意 一个数s它是n进制的,但是每一位不是用'A','B'....表示的,而是用10,11等等表示的,将它还原成十进制 这种表示方法显然会产生多解,然后求所有的解中最小的那个 这题一想就是贪心,但是一开始算法写渣了,改变思路以后才A的 简单来说就是从右边开始,把尽量多的数压到一位里面,这样会使数更小 压的思路可以这么考虑 每次新加进来一个数,如果加进来以后,已经大于原来的那个数,那么就找截取一段可行的最大数 这样考虑的目的是处理前导0带来的影…
Brain's Photos 题目链接: http://codeforces.com/contest/707/problem/A Description Small, but very brave, mouse Brain was not accepted to summer school of young villains. He was upset and decided to postpone his plans of taking over the world, but to becom…
Codeforces Round #297 (Div. 2)C. Ilya and Sticks Time Limit: 2 Sec  Memory Limit: 256 MBSubmit: xxx  Solved: 2xx 题目连接 http://codeforces.com/contest/525/problem/C Description In the evening, after the contest Ilya was bored, and he really felt like ma…
原题地址:http://codeforces.com/contest/758/problem/F F. Geometrical Progression time limit per test 4 seconds memory limit per test 256 megabytes input standard input output standard output For given n, l and r find the number of distinct geometrical pro…
下午闲来无事开了一场Virtual participation 2h就过了3道水题...又跪了..这只是Div. 2啊!!! 感觉这次直接就是跪在了读题上,T1,T2读题太慢,T3还把题读错了 要是让英语老师知道我又要天天背单词背课文去了 看来英语这东西真是不能少... 这次的过的几道题都是属于比较灵活的那种题目,感觉做这种题目挺涨智商的. 题解马上补上~~…
题目链接:http://codeforces.com/contest/758/problem/C 题意:给定N*M矩阵的教室,每个位置都有一个学生,Sergei坐在[X,Y],然后老师会问K个问题,对于行而言问的顺序是从第一行,第二行...第N行,第N-1行...第二行,第一行然后重复.对于列而言问的顺序都是从左到右,现在问你最后问完K个问题后,被提问的最多的同学的次数是多少,被提问的最少的同学的次数是多少,Sergei被提问的次数是多少. 思路:由于k的范围太大,所以不能一个一个模拟,考虑下循…
题目链接:http://codeforces.com/contest/758/problem/B 题意:给定n个点灯的情况,灯只有四种颜色RBGY,然后如果某个灯坏了则用'!'表示,现在要求将坏的灯(即'!'的位置)用其他新的灯来替换(新灯只有前面描述的四种颜色),并且要满足最后的灯序列每连续四个位置的灯的颜色都不一样(即分别是给定的四种颜色,顺序任意).问最后要用每种颜色的灯的数目.题目保证输入一定合法,即一定存在一个符合条件的序列 思路:因为每连续四个位置要满足颜色不一样的要求,所以我们可以…