【PAT甲级】1019 General Palindromic Number (20 分)
题意:
输入两个正整数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 分)的更多相关文章
- 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 ...
- PAT (Advanced Level) Practice 1019 General Palindromic Number (20 分) 凌宸1642
PAT (Advanced Level) Practice 1019 General Palindromic Number (20 分) 凌宸1642 题目描述: A number that will ...
- PAT 甲级 1019 General Palindromic Number (进制转换,vector运用,一开始2个测试点没过)
1019 General Palindromic Number (20 分) A number that will be the same when it is written forwards ...
- PAT 甲级 1019 General Palindromic Number(简单题)
1019. General Palindromic Number (20) 时间限制 400 ms 内存限制 65536 kB 代码长度限制 16000 B 判题程序 Standard 作者 CHEN ...
- PAT 甲级 1019 General Palindromic Number(20)(测试点分析)
1019 General Palindromic Number(20 分) A number that will be the same when it is written forwards or ...
- 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 ...
- 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 ...
- PAT 甲级 1019 General Palindromic Number
https://pintia.cn/problem-sets/994805342720868352/problems/994805487143337984 A number that will be ...
- 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 ...
随机推荐
- Python - 字符串为多行时,转换为列表
例如一个IP代理池,这是个字符串,有多行 120.236.137.65:8060 193.112.208.216:8118 121.8.98.198:80 121.8.98.197:80 121.8. ...
- 8.5-Day1T1--Asm.Def 谈笑风生
题目大意 m个操作, 1:添加一个字符串 2:查询字符串s是否被添加过(中至多包含一个通配符“*”) 题解 trie树可以得部分分 用map映射 '*'就枚举26个英文字母来判断就可以了 #inclu ...
- eclipse修改快捷键
eclipse修改快捷键 ctrl + shift + l查看快捷键 window -> preferences -> 搜索keys 鼠标点击以下五个表头,可以按照内容搜索 示例,选中Bi ...
- ST股
一.简介: 意即“特别处理”.该政策针对的对象是出现财务状况或其他状况异常的. 1998年4月22日,沪深交易所宣布,将对财务状况或其它状况出现异常的上市公司股票交易进行特别处理(Special tr ...
- springboot多模块项目打war包
一.父模块配置 1,指定pakaging:pom 2,指定编译的版本:如下图: <properties> <project.build.sourceEncoding>UTF-8 ...
- react组件之间传值方式
1.父向子(通过props传值) 2.父向更深层的子(通过context传值) 3.子向父(通过回调函数传值:在父组件中创建一个函数来接收子组件传过来的参数值,通过父组件将这个函数做为子组件的属性传递 ...
- 牛客新年AK场之模拟二维数组
链接:https://ac.nowcoder.com/acm/contest/3800/D来源:牛客网 题目描述 Rinne 喜欢使用一种奇怪的方法背单词,现在这些单词被放在了一个 n×mn \tim ...
- java实现二维码的生成和解析:QRCode、zxing 两种方式
第一种:QRCode.jar,使用QRCode生成和解析二维码 1.导入jar包 2.代码 (1)QRCodeUtil .java import com.swetake.util.Qrcode; i ...
- call深入理解
function fn1() { console.log(1); } function fn2() { console.log(2); } fn1.call(fn2); // 1 fn1.call.c ...
- java基础数据类型和处理
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSON; import java.io.*; import j ...