题意:

输入两个正整数n和b(n<=1e9,2<=b<=1e9),分别表示数字的大小和进制大小,求在b进制下n是否是一个回文串,输出“Yes”or“No”,并将数字n在b进制下打印出来,用空格间隔开每一位数字。

AAAAAccepted code:

 #include<bits/stdc++.h>
using namespace std;
int a[];
int main(){
int n,b;
cin>>n>>b;
int cnt=;
while(n){
a[++cnt]=n%b;
n/=b;
}
int flag=;
for(int i=;i<=cnt/;++i)
if(a[i]!=a[cnt-i+])
flag=;
if(!flag)
cout<<"Yes"<<"\n";
else
cout<<"No"<<"\n";
for(int i=cnt;i>;--i)
cout<<a[i]<<" ";
cout<<a[];
return ;
}

【PAT甲级】1019 General Palindromic Number (20 分)的更多相关文章

  1. PAT Advanced 1019 General Palindromic Number (20 分)

    A number that will be the same when it is written forwards or backwards is known as a Palindromic Nu ...

  2. PAT (Advanced Level) Practice 1019 General Palindromic Number (20 分) 凌宸1642

    PAT (Advanced Level) Practice 1019 General Palindromic Number (20 分) 凌宸1642 题目描述: A number that will ...

  3. PAT 甲级 1019 General Palindromic Number (进制转换,vector运用,一开始2个测试点没过)

    1019 General Palindromic Number (20 分)   A number that will be the same when it is written forwards ...

  4. PAT 甲级 1019 General Palindromic Number(简单题)

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

  5. PAT 甲级 1019 General Palindromic Number(20)(测试点分析)

    1019 General Palindromic Number(20 分) A number that will be the same when it is written forwards or ...

  6. PAT甲级——1019 General Palindromic Number

    A number that will be the same when it is written forwards or backwards is known as a Palindromic Nu ...

  7. PAT (Advanced Level) Practice 1019 General Palindromic Number (20 分) (进制转换,回文数)

    A number that will be the same when it is written forwards or backwards is known as a Palindromic Nu ...

  8. PAT 甲级 1019 General Palindromic Number

    https://pintia.cn/problem-sets/994805342720868352/problems/994805487143337984 A number that will be ...

  9. 1019 General Palindromic Number (20 分)

    A number that will be the same when it is written forwards or backwards is known as a Palindromic Nu ...

随机推荐

  1. Spring基础篇——通过Java注解和XML配置装配bean(转载)

      作者:陈本布衣 出处:http://www.cnblogs.com/chenbenbuyi 本文版权归作者和博客园共有,欢迎转载分享,但必须保留此段声明,且在文章页面明显位置给出原文链接,否则保留 ...

  2. Jmeter_正则表达式

    元字符+限定符 元字符: . 任意字符 \d 任意单个数字 [0-9] 0-9 [a-z A-Z] 限定符 + 匹配至少大于1次 ? 匹配0次或者1次 * 匹配0次或者多次 {n}匹配n次 在线正则表 ...

  3. placeholder样式

    .mdwh_txtmod_tp_inpshad input::-webkit-input-placeholder { /* WebKit browsers */ color: #cccccc; } . ...

  4. workspace 打开的是我的电脑

    在system tree板块的空白处右键-->set root-->current workspace 即可恢复workspace.

  5. 「HNOI/AHOI2018」游戏

    传送门 Luogu 解题思路 这是一道 \(O(n^2)\) 暴力加上 \(\text{random_shuffle}\) 优化 什么鬼 就可以 \(\text{AC}\) 的题. 但还是要讲一下 \ ...

  6. 「JSOI2012」玄武密码

    「JSOI2012」玄武密码 传送门 题目是要求多个串在母串上的最长匹配长度. 考虑 \(\text{AC}\) 自动机,我们建出 \(\text{Trie}\) 图然后用母串来在上面跑. 每一个能匹 ...

  7. Java电子书高清PDF集合免费下载

    这份资源是我经过多年积累才整理归类出来,有很多电子书我觉质量还是非常高的,由于电子书太多我也是用业余时间挑着看的,这么多资源自己保存着也是浪费,就想着现在把资源分享出来,希望能真正帮到大家: 资源我都 ...

  8. 吴裕雄--天生自然Numpy库学习笔记:NumPy 统计函数

    NumPy 提供了很多统计函数,用于从数组中查找最小元素,最大元素,百分位标准差和方差等. numpy.amin() 用于计算数组中的元素沿指定轴的最小值. numpy.amax() 用于计算数组中的 ...

  9. 线程同步 - POSIX互斥锁

    线程同步 - POSIX互斥锁 概括 本文讲解POSIX中互斥量的基本用法,从而能达到简单的线程同步.互斥量是一种特殊的变量,它有两种状态:锁定以及解锁.如果互斥量是锁定的,就有一个特定的线程持有或者 ...

  10. Promise解决回调地狱(多层调用问题)

    Promise # Promise 是异步编程的一种解决方案:从语法上讲,promise是一个对象,从它可以获取异步操作的消息:从本意上讲,它是承诺,承诺它过一段时间会给你一个结果.promise有三 ...