AC代码

#include <cstdio>
const int max_n = 1000;
long long ans[max_n];
int num = 0;
void change(long long a, long long d) {
do {
ans[num++] = a % d;
a /= d;
} while(a != 0);
} int main() {
#ifdef ONLINE_JUDGE
#else
freopen("1.txt", "r", stdin);
#endif // ONLINE_JUDGE}
long long a, d;
scanf("%lld %lld", &a, &d);
change(a, d);
bool flag = 1;
for(int i = 0; i < num - 1- i; i++) {
if(ans[i] != ans[num - 1 - i]) flag = false;
}
if(flag == true) printf("Yes\n");
else if(flag == false) printf("No\n");
for(int i = num - 1; i >= 0; i--) {
if(i != num - 1) printf(" ");
printf("%d", ans[i]);
}
return 0;
}

PAT A1019 General Palindromic Number (20 分)的更多相关文章

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

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

  2. PAT A1019 General Palindromic Number (20 分)——回文,进制转换

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

  3. 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 ...

  4. 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 ...

  5. [PAT] A1019 General Palindromic Number

    [题目] https://pintia.cn/problem-sets/994805342720868352/problems/994805487143337984 题目大意:给定一个N和b,求N在b ...

  6. 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 ...

  7. 【PAT甲级】1019 General Palindromic Number (20 分)

    题意: 输入两个正整数n和b(n<=1e9,2<=b<=1e9),分别表示数字的大小和进制大小,求在b进制下n是否是一个回文串,输出“Yes”or“No”,并将数字n在b进制下打印出 ...

  8. PAT 1019 General Palindromic Number[简单]

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

  9. pat1019. General Palindromic Number (20)

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

随机推荐

  1. Restorator 2018 v3.90汉化注册版 含注册码汉化激活教程

    链接:https://pan.baidu.com/s/1wfh5VQfNgbDr-glezL4faQ 提取码:y507

  2. zstu 4237 马里奥的求救——(单调队列DP)

    题目链接:http://oj.acm.zstu.edu.cn/JudgeOnline/problem.php?id=4237 这题可以转化为每次可以走g~d+x步,求最大分数,且最大分数的步数最少. ...

  3. HTML5 烟花系统

    需求:在一个虚拟烟花球中,在不同的部位填充不同颜色.质地的烟花火药:观看试放效果.最好能结合点物理学定律(以便展现火药粉被爆炸扩散到一定程度再爆炸的效果) 这是这学期的一个作业,感觉挺无聊的,纯粹是老 ...

  4. 【面试】ArrayList 和 HaseMap 的区别和应用场景

    ArrayLiat: ArrayList array = new ArrayList(); array.add("张三"); array.add("李四"); ...

  5. dubbo服务层面上的负载均衡和高可用

    dubbo上的服务层可以做集群,来达到负载均衡和高可用,很简单,只需要在不同的服务器节点上向同一个zk(内网环境)注册相同的服务 注意就是,消费者不能在同一个zk做这种集群操作的 转载请注明博客出处: ...

  6. mybatis用Map<Long,List<String>>作为参数

    mapper.xml文件里的<insert id="insertByMap" parameterType="java.util.Map"> inse ...

  7. Nginx之共享内存与slab机制

    1. 共享内存 在 Nginx 里,一块完整的共享内存以结构体 ngx_shm_zone_t 来封装,如下: typedef struct ngx_shm_zone_s ngx_shm_zone_t; ...

  8. linux 搜索文件夹下的所有文件内容

    find . -type f -name "*.*" | xargs grep "博客园"

  9. rsync+inotify 实时双向同步

    前言 在遇到需要 nginx 负载均衡,承受较高并发的情况,同时会有双机相同目录内容须保持一致的需求 rsync+inotify 是一个不错的解决方案,相较于 rsync+sersync 在处理大量文 ...

  10. pytorch-Alexnet 网络

    Alexnet网络结构, 相比于LeNet,Alexnet加入了激活层Relu, 以及dropout层 第一层网络结构: 11x11x3x96, 步长为4, padding=2 第二层网络结构: 5x ...