4493: Remove Digits Description Given an N-digit number, you should remove K digits and make the new integer as large as possible. Input The first line has two integers N and K (N不大于500000). The next line has a N-digit number with no leading zero. Ou
C. Divisibility by Eight Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/contest/550/problem/C Description You are given a non-negative integer n, its decimal representation consists of at most 100 digits and doesn't contain leadin
A. Two Substrings time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output You are given string s. Your task is to determine if the given string s contains two non-overlapping substrings "AB"
Divisibility by Eight time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output You are given a non-negative integer n, its decimal representation consists of at most 100 digits and doesn't contain
C. Divisibility by Eight time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output You are given a non-negative integer n, its decimal representation consists of at most 100 digits and doesn't conta
Divisibility by Eight time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output You are given a non-negative integer n, its decimal representation consists of at most 100 digits and doesn't contain
A. Two Substrings You are given string s. Your task is to determine if the given string s contains two non-overlapping substrings "AB" and "BA" (the substrings can go in any order). Input The only line of input contains a string s of l
C. Divisibility by Eight time limit per test : 2 seconds memory limit per test : 256 megabytes input : standard input output : standard output You are given a non-negative integer n, its decimal representation consists of at most 100 digits and doesn
原题链接在这里:https://leetcode.com/problems/split-array-into-fibonacci-sequence/ 题目: Given a string S of digits, such as S = "123456579", we can split it into a Fibonacci-like sequence [123, 456, 579]. Formally, a Fibonacci-like sequence is a list F o
1.问题描述 2.问题分析 循环拆分数字,然求和判断. 3.代码 int addDigits(int num) { ) return num; int result = num; do{ vector<int> r = splitnum( result ); result = ; for(auto & n : r ){ result += n; } } ); return result ; } vector<int> splitnum( int num ){ vector&
更好的阅读体验 Portal Portal1: Codeforces Portal2: Luogu Description Jeff's got n cards, each card contains either digit 0, or digit 5. Jeff can choose several cards and put them in a line so that he gets some number. What is the largest possible number div
一个简单的模拟,首先先计算当前是几位数,然后根据几位数推断当前的数是什么,然后求出该位即可 #include <cstdio> int main(){ long long k; scanf("%lld", &k); long long cur = 1, cnt = 9; while (cur * cnt < k){k -= cur * cnt; cnt *= 10, ++cur;} long long mod = k % cur, a = (k - 1) /