ICode9

精准搜索请尝试: 精确搜索
  • 1019 General Palindromic Number (20 分)2021-03-07 09:04:15

    #include<bits/stdc++.h> using namespace std; vector<int> convertNum; void convert(long long num, int radix) { do { convertNum.push_back(num % radix); num /= radix; } while(num != 0); } int main() { long long num; int radix; cin &g

  • PAT甲级-进制转换、回文数类型-1019 General Palindromic Number解题思路2021-02-24 21:29:52

    1019 General Palindromic Number (20 分) 思路 代码一的进制转换用了一个非常繁琐的方法,除法进制转换,所以在第二个代码用了求余进制转换。 回文数,for循环搜索一半判断即可。 代码一 #include <bits/stdc++.h> using namespace std; int main() { int N,b,n,temp;

  • 1019 General Palindromic Number2021-02-08 19:33:17

    1019 General Palindromic Number A number that will be the same when it is written forwards or backwards is known as a Palindromic Number. For example, 1234321 is a palindromic number. All single digit numbers are palindromic numbers. Although palindromic

  • PAT 1019 General Palindromic Number2021-01-21 22:06:12

    A number that will be the same when it is written forwards or backwards is known as a Palindromic Number. For example, 1234321 is a palindromic number. All single digit numbers are palindromic numbers. Although palindromic numbers are most often consider

  • 1332.remove-palindromic-subsequences2021-01-17 16:02:06

    1332. 删除回文子序列 题目描述 字符串s仅由a和b构成,每一次删除操作可以从s中删除一个回文子串,问删空需要删除几次? 官方思路 这是一道脑筋急转弯题目。。。 由于只有 a 和 b 两个字符。其实最多的消除次数就是 2。因为我们无论如何都可以先消除全部的 1 再消除全部的 2(先消除

  • leetcode 647. Palindromic Substrings(python)2020-12-21 14:59:48

    描述 Given a string, your task is to count how many palindromic substrings in this string. The substrings with different start indexes or end indexes are counted as different substrings even they consist of same characters. Example 1: Input: "abc"

  • leetcode 647. Palindromic Substrings(python)2020-12-21 14:58:26

    描述 Given a string, your task is to count how many palindromic substrings in this string. The substrings with different start indexes or end indexes are counted as different substrings even they consist of same characters. Example 1: Input: "abc"

  • leetcode 647. Palindromic Substrings(回文子串)2020-11-27 22:33:33

    Given a string, your task is to count how many palindromic substrings in this string. The substrings with different start indexes or end indexes are counted as different substrings even they consist of same characters. Example 1: Input: “abc” Output: 3

  • LeetCode 5. Longest Palindromic Substring?2020-11-22 11:58:03

    Given a string s, return the longest palindromic substring in s. return that longest palindrome. this is not some regular dp problems, if i first saw this problem, there is no way I will think of this a dp problem. because we need to return the actual pa

  • 647. Palindromic Substrings2020-11-06 23:01:42

    package LeetCode_647 /** * 647. Palindromic Substrings * https://leetcode.com/problems/palindromic-substrings/ * Given a string, your task is to count how many palindromic substrings in this string. The substrings with different start indexes or end i

  • PAT A1019 General Palindromic Number (20) [回⽂数 进制转换]2020-07-18 11:32:38

    题目链接 题目链接 题目 给定一个十进制数和基数,判断对应进制数是否回文数,并打印 1 0是回文数 2 题目中没有标明大于10的进制中字母如何处理,试错发现,并不能将两位数字转化为字母,而是使用两位数字,并且在判断回文和打印时,这个两位数字都看做一个整体 解题思路 因为要用两位数字表示

  • 5.Longest Palindromic Substring2020-05-15 20:57:19

    给定一个字符串,求字符串中最长的回文子串。Input: "babad"Output: "bab"Note: "aba" is also a valid answer. 思路:一、暴力解决,O(n^3) 的时间复杂度,最外层循环为 子串的起始位置,第二层循环为,对字符串中的字符遍历,若与子串的第一个字符相等,则停下来验证这一个子串是否是回文,第里层

  • 【每天一道PAT】1019 General Palindromic Number2020-04-18 23:01:14

    直接用了1015的取回文函数,秒答 思路 用动态数组存储每一位数字 反着构成新的数字判断与原数字是否相等即可。 #include <cstdio> #include <cmath> #include <vector> using namespace std; vector<int> num; int reverse(int n,int r) { int result = 0; do { nu

  • 1019 General Palindromic Number (20分)2020-03-19 16:05:43

       本题一遍过...20分的题好像相对来说是比较简单的。本题主要涉及进制转换和回文判断。   1 #include<iostream> 2 #include<vector> 3 #include<cstdio> 4 using namespace std; 5 int main(){ 6 int n,b; 7 cin>>n>>b; 8 int digit[10000]={0}; 9

  • PAT A1024 Palindromic Number(***大整数运算+回文串判断)2020-03-09 15:04:10

    Note: reverse(b.d, b.d+b.len)倒置大整数b。reverse函数在头文件<algorithm>中。 题意:     定义一个操作:让一个整数加上这个整数首尾颠倒后的数字。例如对整数1257执行操作就是1257+7521=8778。现在给出一个正整数和操作次数限制,问在限定的操作次数内能是否能得到回文数。如果

  • PAT-进制转换-A1019 General Palindromic Number (20分)2020-03-03 21:56:57

    题目描述:   给出两个整数n、b,问十进制整数n在b进制下是否是回文数,若是,则输出Yes;否则,输出No。在此之后输出n在b进制下的表示。   单词:Palindromic Number--回文数;decimal--十进制的。  输入格式:   输入用空格分隔的两个数,第一个数是十进制数n(0<N≤10​9),第二个数是十进制数

  • 5. 最长回文子串 Longest Palindromic Substring2020-02-21 20:01:27

    (1) 暴力求解 class Solution: def longestPalindrome(self, s: str) -> str: maxlen=0 result='' for i in range(len(s)): for j in range(i,len(s)+1):##注意首尾坐标 if s[i:j]==s[i:j][::-1]:

  • 5. Longest Palindromic Substring**2020-02-20 10:38:36

    5. Longest Palindromic Substring** https://leetcode.com/problems/longest-palindromic-substring/ 题目描述 Given a string s, find the longest palindromic substring in s. You may assume that the maximum length of s is 1000. Example 1: Input: "babad" Ou

  • LeetCode-5 Longest Palindromic Substring2020-02-04 22:08:47

    Description Given a string s, find the longest palindromic substring in s. You may assume that the maximum length of s is 1000. Example Example 1: Input: “babad” Output: “bab” Note: “aba” is also a valid answer. Example 2: Input: “cbbd” Output:

  • 5. Longest Palindromic Substring2020-02-04 21:00:56

    Given a string s, find the longest palindromic substring in s. You may assume that the maximum length of s is 1000. Example 1: Input: "babad" Output: "bab" Note: "aba" is also a valid answer. Example 2: Input: "cbbd&quo

  • PAT Advanced 1019 General Palindromic Number (20分)2020-01-27 12:52:45

    A number that will be the same when it is written forwards or backwards is known as a Palindromic Number. For example, 1234321 is a palindromic number. All single digit numbers are palindromic numbers. Although palindromic numbers are most often considere

  • 刷题5. Longest Palindromic Substring2020-01-26 12:00:11

    一、题目说明 Longest Palindromic Substring,求字符串中的最长的回文。 Difficuty是Medium 二、我的实现 经过前面4个题目,我对边界考虑越来越“完善”了。 总共提交了5次: 第1、2次:Wrong Answer 主要是"cbbd"错误了,重复的判断逻辑上出了点小问题 第3、4次: Time Limit Exceeded 我本

  • [PAT-A 1019]General Palindromic Number2020-01-15 10:40:00

    题目大意: 给定一个十进制数n,求该十进制数转换为b进制后的序列是否为回文序列 思路: 1.进制转换,10进制n转换为b进制,除积取余法,ans[表示结果],输出时倒着遍历 也可以用栈,但是本题要判断回文序列,数组更方便。 do { ans[num++] = n % b; n /= b; } while (n != 0); 2.判断

  • Longest Palindromic Substring2019-12-01 16:57:36

    Longest Palindromic Substring Given a string s, find the longest palindromic substring in s. You may assume that the maximum length of s is 1000. Example 1: Input: "babad"Output: "bab"Note: "aba" is also a valid answer.Examp

  • Leetcode: Palindromic Substrings2019-09-30 14:01:42

    647. Palindromic SubstringsMedium165685FavoriteShareGiven a string, your task is to count how many palindromic substrings in this string.The substrings with different start indexes or end indexes are counted as different substrings even they consist of sa

专注分享技术,共同学习,共同进步。侵权联系[81616952@qq.com]

Copyright (C)ICode9.com, All Rights Reserved.

ICode9版权所有