#include<iostream>
#include<cstring>
#include<algorithm>
using namespace std;
int n, b, cnt;
bool ispalindromic(int num[])
{
for (int i = 0; i < cnt / 2; i++)
{
if (num[i] != num[cnt - 1 - i])return false;
}
return true;
}
int main()
{
scanf("%d%d", &n, &b);
int num[1000];
do
{
num[cnt++] = n%b;
n /= b;
} while (n);
if (ispalindromic(num))printf("Yes\n");
else printf("No\n");
reverse(num, num + cnt);
for (int i = 0; i < cnt; i++)
{
printf("%d", num[i]);
if (i != cnt-1)printf(" ");
}
return 0;
}
1019 General Palindromic Number (20)(20 分)
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請聯(lián)系作者
- 文/潘曉璐 我一進店門酱固,熙熙樓的掌柜王于貴愁眉苦臉地迎上來,“玉大人头朱,你說我怎么就攤上這事运悲。” “怎么了项钮?”我有些...
- 文/不壞的土叔 我叫張陵班眯,是天一觀的道長。 經(jīng)常有香客問我烁巫,道長署隘,這世上最難降的妖魔是什么? 我笑而不...
- 正文 為了忘掉前任亚隙,我火速辦了婚禮磁餐,結(jié)果婚禮上,老公的妹妹穿的比我還像新娘阿弃。我一直安慰自己诊霹,他們只是感情好羞延,可當(dāng)我...
- 文/花漫 我一把揭開白布。 她就那樣靜靜地躺著畅哑,像睡著了一般肴楷。 火紅的嫁衣襯著肌膚如雪。 梳的紋絲不亂的頭發(fā)上荠呐,一...
- 文/蒼蘭香墨 我猛地睜開眼彤恶,長吁一口氣:“原來是場噩夢啊……” “哼钞钙!你這毒婦竟也來了?” 一聲冷哼從身側(cè)響起声离,我...
- 正文 年R本政府宣布,位于F島的核電站嗤瞎,受9級特大地震影響墙歪,放射性物質(zhì)發(fā)生泄漏。R本人自食惡果不足惜贝奇,卻給世界環(huán)境...
- 文/蒙蒙 一虹菲、第九天 我趴在偏房一處隱蔽的房頂上張望。 院中可真熱鬧掉瞳,春花似錦毕源、人聲如沸浪漠。這莊子的主人今日做“春日...
- 文/蒼蘭香墨 我抬頭看了看天上的太陽址愿。三九已至,卻和暖如春冻璃,著一層夾襖步出監(jiān)牢的瞬間响谓,已是汗流浹背。 一陣腳步聲響...
推薦閱讀更多精彩內(nèi)容
- A number that will be the same when it is written forward...
- 1144 The Missing Number(20 分) Given N integers, you are s...
- A number that will be the same when it is written forward...
- 題目信息 A number that will be the same when it is written fo...