940C Phone Numbers】的更多相关文章

传送门 题目大意 给你两个数字n和k,给你一个字符串s,n是s的长度,求字母集合是s的字母集合子集的字典序大于s的长度为k的字典序最小的字符串t 分析 将字符转化为数字,然后分两种情况处理: 1.n<k:t的前n为是s,后面几位是s中字典序最小的字母 2.n>=k:将t赋为s的前k位,从t的最后一位开始,如果字符子集中有字典序比它大的则将其替换为比其大的中字典序最小的字符,否则将其替换为整个字符子集中字典序最小的字符,在此位的前一位重复此步骤 代码 #include<iostream&g…
从这里开始 题目列表 小结 Problem A Points on the line Problem B Our Tanya is Crying Out Loud Problem C Phone Numbers Problem D Alena And The Heater Problem E Cashback Problem F Machine Learning 小结 这场比赛和同学一起打.本来应该是很开心的事情,结果留下好多遗憾. 第一个遗憾是没能在20分钟内消灭A.B题.然后分数就不是很可观…
940C链接:http://codeforces.com/problemset/problem/940/C C. Phone Numbers time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output And where the are the phone numbers? You are given a string s consist…
在Java位运算总结-leetcode题目博文中总结了Java提供的按位运算操作符,今天又碰到LeetCode中一道按位操作的题目 Given a range [m, n] where 0 <= m <= n <= 2147483647, return the bitwise AND of all numbers in this range, inclusive. For example, given the range [5, 7], you should return 4. 题意:…
Sum of Consecutive Prime Numbers Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 20050   Accepted: 10989 Description Some positive integers can be represented by a sum of one or more consecutive prime numbers. How many such representatio…
You are given two linked lists representing two non-negative numbers. The most significant digit comes first and each of their nodes contain a single digit. Add the two numbers and return it as a linked list. You may assume the two numbers do not con…
Given a non-empty array of numbers, a0, a1, a2, … , an-1, where 0 ≤ ai < 231. Find the maximum result of ai XOR aj, where 0 ≤ i, j < n. Could you do this in O(n) runtime? Example: Input: [3, 10, 5, 25, 2, 8] Output: 28 Explanation: The maximum resul…
Given a non-negative integer n, count all numbers with unique digits, x, where 0 ≤ x < 10n. Example: Given n = 2, return 91. (The answer should be the total numbers in the range of 0 ≤ x < 100, excluding [11,22,33,44,55,66,77,88,99]) Hint: A direct…
Given a range [m, n] where 0 <= m <= n <= 2147483647, return the bitwise AND of all numbers in this range, inclusive. For example, given the range [5, 7], you should return 4. Credits:Special thanks to @amrsaqr for adding this problem and creatin…
Given a text file file.txt that contains list of phone numbers (one per line), write a one liner bash script to print all valid phone numbers. You may assume that a valid phone number must appear in one of the following two formats: (xxx) xxx-xxxx or…