文章目录

  • 题目分析
  • 题目链接

题目分析

ac代码

#include<bits/stdc++.h>
using namespace std;//判回文数
bool check(vector<int>& a){for( int i =0, j =a.size()-1; i<j ;i++ ,j--)if(a[i]!= a[j]) return false;return true;
}int main(){int n ,k;cin>>n>>k;vector<int> a;//读入的不是0if(n){while(n){ //求出k进制下的每一位,从低到高int r = n% k;a.push_back(r);n/=k;}if(check(a)) cout<<"Yes"<<endl;else cout<<"No"<<endl;int res = a.size()-1;for(int i=res; i>0;i--) cout<<a[i]<<" ";cout<<a[0];}else{ //读入的是0cout<<"Yes"<<endl;cout<<0;}
}

题目链接

PAT甲级1019 General Palindromic Number

PAT甲级1019 General Palindromic Number:[C++题解]进制位、回文数、vector来做相关推荐

  1. 浙大PAT甲级1019. General Palindromic Number (20)

    1019. General Palindromic Number (20) 时间限制 400 ms 内存限制 65536 kB 代码长度限制 16000 B 判题程序 Standard 作者 CHEN ...

  2. PAT甲级1100 Mars Numbers:[C++题解]进制位、使用stringstream类读入

    文章目录 题目分析 题目分析 分析: 使用char型二维数组 names[][5] 存储这些 火星文. ac代码 #include<iostream> #include<sstrea ...

  3. PAT甲级1015 Reversible Primes :[C++题解]进制位、秦九韶算法、判质数

    文章目录 题目分析 题目链接 题目分析 十进制转化为d进制如何做? while(n){n% d; //取d进制数下的最低位n/=d; } 比如 十进制下的n=13 ,进制d =2.经过 反复的n%d ...

  4. 1019 General Palindromic Number (20分)_18行代码AC

    立志用最少的代码做最高效的表达 PAT甲级最优题解-->传送门 A number that will be the same when it is written forwards or bac ...

  5. 1019. General Palindromic Number (20)

    题目连接:https://www.patest.cn/contests/pat-a-practise/101 原题如下: A number that will be the same when it ...

  6. Palindromic Numbers LightOJ - 1205 数位dp 求回文数

    传送门 文章目录 题意: 思路: 题意: 求[l,r][l,r][l,r]中有多少个回文数. 思路: 裸的数位dpdpdp啦,记dp[pos][pre][state]dp[pos][pre][stat ...

  7. 【PAT - 甲级1024】Palindromic Number (25分)(大数,模拟)

    题干: A number that will be the same when it is written forwards or backwards is known as a Palindromi ...

  8. PAT甲级1027 Colors in Mars :[C++题解]进制位

    文章目录 题目分析 题目链接 题目分析 就是十进制数转化成13进制,然后数字转化成字符. get函数用来将数字转化成字符. 如果 一位数 就是return x +'0'如果 大于9 就是 return ...

  9. PAT甲级1010 Radix :[C++题解]进制位、秦九韶算法、二分(PAT通过率最低的一道题0.11)

    文章目录 题目分析 题目链接 题目分析 分析: 本题思路分两步. 第一步:先把给出数值和进制的数,暂定为N1,转换成10进制,即为target. 第二步: 判断一下N2在多少进制下是等于target的 ...

最新文章

  1. springmvc+spring+mybatis+maven项目集成shiro进行用户权限控制【转】
  2. POJ3982 序列
  3. gcc 编译器常用的命令行参数一览
  4. AutoCAD VBA对齐对象
  5. 【机器视觉】 dev_close_window算子
  6. Taro+react开发(35) 实现拖动
  7. 公有云、私有云、混合云的区别比较
  8. Swift 委托/代理设计模式
  9. 4、数据表的创建与更新
  10. 计算机插本2a院校,广东省专插本2A院校有哪些
  11. Linux定时任务-Cron表达式详解
  12. 2021-05-14
  13. NCBI数据库以及常用编号
  14. 《 没有业绩怎么写好年终总结.ppt 》
  15. 软件架构师应具备的十大特点
  16. 抢红包案例分析以及代码实现(二)
  17. Android 应用程序未安装问题
  18. 饭否叽歪都挂了,执行者更新
  19. Win10 防止电脑变卡的优化方法
  20. 整样运用计算机考试,计算机等级考试真题的重要性及如何高效利用?

热门文章

  1. 【FI 收付款条件】Payment Terms 收付款条件
  2. Android上下左右滑动,显示底层布局
  3. Python 2.7 Exception格式化工具
  4. delete与delete[]
  5. C# 3.X -- the newest features
  6. 用时间分类能量再用能量分类时间
  7. 双显卡能双屏显示吗_i5-8305G+双显卡交火,最近很火的迷你主机零刻Turbo性能靠谱吗?...
  8. 【UGV】小车一些图片 麦轮版小车
  9. Altium Designer 资料整理
  10. 云服务器+开发板搭建直播系统,自建流媒体服务器开直播