Files
ClassFeedback/.claude/temp/prob_S0401P3.html

359 lines
36 KiB
HTML
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<!DOCTYPE html>
<html data-page="problem_detail" data-layout="basic" class="layout--basic page--problem_detail theme--light nojs" lang="zh" data-app="Hydro">
<head>
<meta charset="UTF-8">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<meta http-equiv="X-UA-Compatible" content="chrome=1"/>
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1" />
<link rel="apple-touch-icon" sizes="180x180" href="/apple-touch-icon-180x180.png">
<link rel="icon" type="image/png" href="/favicon-32x32.png" sizes="32x32">
<link rel="icon" type="image/png" href="/android-chrome-192x192.png" sizes="192x192">
<link rel="icon" type="image/png" href="/favicon-96x96.png" sizes="96x96">
<link rel="icon" type="image/png" href="/favicon-16x16.png" sizes="16x16">
<link rel="canonical" href="oj.qonnwolf.com/p/S0401P3"> <meta name="theme-color" content="#56758f">
<meta property="og:locale" content="zh" />
<meta property="og:title" content="S0401P3. 小杨的进制数位 - 穹狼科创" />
<meta property="og:description" content="题目描述
小杨在学进制转换。给定十进制数 n 和目标进制 k(2≤k≤16),请把 n 转换成 k 进制表示,并统计这个表示中的字符构成:
1. k 进制表示(超过 9 的数位用大写字母 A~F 表示..." />
<title>小杨的进制数位 - 题目详情 - 穹狼科创</title>
<style>
body {
--font-family: "Open Sans", "Open Sans", "Seravek", "Segoe UI", "Verdana", "PingFang SC", "Hiragino Sans GB", "Lantinghei SC", "Microsoft Yahei", "WenQuanYi Micro Hei", "sans";
--code-font-family: "Source Code Pro", "monaco", "Source Code Pro", "Consolas", "Lucida Console", "monospace";
--font-ligatures: none !important;
}
.section{border-radius:10px}
#panel { display: flex; flex-direction: column; }
</style>
<link rel="stylesheet" media="all" href="/theme-4.58.3.css">
<script>
var _htmlNode = document.documentElement;
_htmlNode.className = _htmlNode.className.replace(' nojs', ' hasjs');
var UiContext = '{"cdn_prefix":"/","cdn_dynamic":false,"url_prefix":"/","ws_prefix":"/","hydroacFeatures":[],"blspHost":"wss://ws.hydrooj.com","constantVersion":"058f6069","domainId":"system","domain":{"_id":"system","lower":"system","owner":1,"name":"\u7A79\u72FC\u79D1\u521B","bulletin":"# \u2B50\u6B22\u8FCE\u4F7F\u7528\u7A79\u72FC\u79D1\u521B\u5728\u7EBF\u5B66\u4E60\u8BC4\u6D4B\u7CFB\u7EDF\u2B50\\r\\n\\r\\n## \uD83C\uDF89\uFE0F \u8BAD\u7EC3\u9898\u5355\\r\\n\\r\\n## <a>GESP\uFF1A</a><a href=\\"/training/6a29310829916258dec7763b\\" target=\\"_blank\\">\u4E00\u7EA7</a> | <a href=\\"/training/6a29335129916258dec7777a\\" target=\\"_blank\\">\u4E8C\u7EA7</a> | <a href=\\"/training/6a29337b29916258dec7777b\\" target=\\"_blank\\">\u4E09\u7EA7</a> | <a href=\\"/training/6a2933bd29916258dec7777d\\" target=\\"_blank\\">\u56DB\u7EA7</a> | <a href=\\"/training/6a2933f429916258dec77780\\" target=\\"_blank\\">\u4E94\u7EA7</a> | <a href=\\"/training/6870ca337e50189ceb63bf59\\" target=\\"_blank\\">\u516D\u7EA7</a> | <a href=\\"/training/6870caa37e50189ceb63bfa8\\" target=\\"_blank\\">\u4E03\u7EA7</a> | <a href=\\"/training/6a29341e29916258dec77784\\" target=\\"_blank\\">\u516B\u7EA7</a>\\r\\n## <a>CSP-JS\uFF1A</a><a href=\\"/d/CSP_J1/\\" target=\\"_blank\\">\u521D\u8D5B</a> | <a href=\\"/training/6a29346529916258dec77788\\" target=\\"_blank\\">\u590D\u8D5B</a> \\r\\n\\r\\n---\\r\\n## \uD83C\uDF89\uFE0F \u62D3\u5C55\u8BAD\u7EC3\\r\\n\\r\\n### A\uFF1A<a href=\\"/training/686f1e417e50189ceb630e98\\" target=\\"_blank\\">\u987A\u5E8F\u7ED3\u6784</a> | <a href=\\"/training/6a29350929916258dec77791\\" target=\\"_blank\\">\u5206\u652F\u7ED3\u6784</a> | <a href=\\"/training/6a29353229916258dec77792\\" target=\\"_blank\\">\u5FAA\u73AF\u7ED3\u6784</a> | <a href=\\"/training/6a29355e29916258dec77793\\" target=\\"_blank\\">\u7A77\u4E3E\u7B97\u6CD5</a> \\r\\n\\r\\n### B\uFF1A<a href=\\"/training/686f20057e50189ceb630fb6\\" target=\\"_blank\\">\u4E00\u7EF4\u6570\u7EC4</a> | <a href=\\"/training/6a2932b229916258dec77767\\" target=\\"_blank\\">\u5B57\u7B26\u4E32</a> | <a href=\\"/training/686f20f07e50189ceb630ff2\\" target=\\"_blank\\">\u4E8C\u7EF4\u6570\u7EC4</a> | <a href=\\"/training/686f21347e50189ceb630ffb\\" target=\\"_blank\\">\u51FD\u6570</a> | <a href=\\"/training/686f21597e50189ceb631020\\" target=\\"_blank\\">\u7ED3\u6784\u4F53</a> | <a href=\\"/training/68fb217e65d6c0e8cf403f39\\" target=\\"_blank\\">\u6570\u636E\u6392\u5E8F</a>\\r\\n\\r\\n\\r\\n\\r\\n### C\uFF1A<a href=\\"/training/686f23487e50189ceb631156\\" target=\\"_blank\\">\u9012\u63A8\u4E0E\u9012\u5F52</a> | <a href=\\"/training/686f23687e50189ceb6311a0\\" target=\\"_blank\\">\u8D2A\u5FC3</a> | <a href=\\"/training/686f23927e50189ceb6311a7\\" target=\\"_blank\\">\u8FDB\u5236\u8F6C\u6362</a> | <a href=\\"/training/686f23b87e50189ceb6311c6\\" target=\\"_blank\\">\u9AD8\u7CBE\u5EA6</a> | <a href=\\"/training/686f25767e50189ceb63121e\\" target=\\"_blank\\">\u4E8C\u5206</a> | <a href=\\"/training/6915a5c367ceffb06f6af7fa\\" target=\\"_blank\\">\u5206\u6CBB\u7B97\u6CD5</a>\\r\\n\\r\\n### D\uFF1A<a href=\\"/training/686f24377e50189ceb6311f3\\" target=\\"_blank\\">\u6DF1\u5EA6\u4F18\u5148\u641C\u7D22</a> | <a href=\\"/training/686f25527e50189ceb631219\\" target=\\"_blank\\">\u5E7F\u5EA6\u4F18\u5148\u641C\u7D22</a> | <a href=\\"/training/68883b387e50189ceb68b539\\" target=\\"_blank\\">\u524D\u7F00\u548C\u5DEE\u5206</a> | <a href=\\"/training/6a29330529916258dec77777\\" target=\\"_blank\\">\u52A8\u6001\u89C4\u5212</a> | <a href=\\"/training/686f26787e50189ceb63122e\\" target=\\"_blank\\">\u80CC\u5305</a> | <a href=\\"/training/68fb20fd65d6c0e8cf403f0c\\" target=\\"_blank\\">\u5176\u4ED6\u7B97\u6CD5</a>\\r\\n\\r\\n### E\uFF1A<a href=\\"/training/686f26b67e50189ceb631234\\" target=\\"_blank\\">\u56FE\u8BBA</a> | <a href=\\"/training/686f26e17e50189ceb63123c\\" target=\\"_blank\\">\u5E76\u67E5\u96C6</a> | <a href=\\"/training/686f27317e50189ceb631247\\" target=\\"_blank\\">\u533A\u95F4\u95EE\u9898</a> | <a href=\\"/training/686f27867e50189ceb631251\\" target=\\"_blank\\">\u6811\u53CA\u6811\u7684\u5E94\u7528</a> | <a href=\\"/training/686f27c17e50189ceb631257\\" target=\\"_blank\\">\u6570\u8BBA</a> | <a href=\\"/training/68fb219d65d6c0e8cf403f3a\\" target=\\"_blank\\">\u6570\u636E\u7ED3\u6784</a> \\r\\n---\\r\\n\\r\\n## \uD83C\uDF89\uFE0F <a href=\\"/d/Level_Test/\\" >\u6559\u5E08\u5B66\u751F\u80FD\u529B\u6D4B\u8BD5</a> | <a href=\\"https://oj.qonnwolf.com/d/Level_Test/p/A0001\\" >\u4FE1\u606F\u5B66\u6478\u5E95\u6D4B\u8BD5</a>\\r\\n\\r\\n---","roles":{"guest":"1","default":"87927944873247617","teacher":"2324866211840808047607","su_teacher":"2334089583877664274423","Other_Teacher":"2213715239984621994885","AI":"2186515631287987861489"},"avatar":"url:/file/2/qonnwolf-logo2.png","langs":"","share":"*","enableDownloadFirst":"on"},"extraTitleContent":"\u5C0F\u6768\u7684\u8FDB\u5236\u6570\u4F4D","SWConfig":{"preload":"","hosts":["http://oj.qonnwolf.com","https://oj.qonnwolf.com","oj.qonnwolf.com/","/"],"assets":[],"domains":[]}}';
var UserContext = '{"_id":339,"mail":"chengzi2508@bjcodemao.com","uname":"\u6A59\u5B50\u8001\u5E08","hashType":"hydro","priv":33554436,"regat":"2025-08-18T01:14:43.815Z","loginat":"2026-09-02T09:30:29.620Z","perm":"BigInt::2334089583877664274423","role":"su_teacher","scope":"BigInt::-1","tfa":false,"authn":false,"group":["\u6559\u5E08\u56E2\u961F","339"],"domains":[],"viewLang":"zh","timeZone":"Asia/Shanghai","codeLang":"cc.cc14o2","codeTemplate":"","avatar":"url:/file/339/.avatar.png","qq":"","gender":"0","bio":"\u9752\uFF0C\u53D6\u4E4B\u4E8E\u84DD\u800C\u9752\u4E8E\u84DD\u3002\u51B0\uFF0C\u6C34\u4E3A\u4E4B\u800C\u5BD2\u4E8E\u6C34\u3002\\r\\n","school":"\u7F16\u7A0B\u732B\u5927\u5B66","studentId":"111","backgroundImage":"/components/profile/doubao_avatar_new.png","unreadMsg":0,"badge":"","pinnedDomains":[],"rounded":false,"skipAnimate":false,"showTimeAgo":true,"fontFamily":"Open Sans","codeFontFamily":"Source Code Pro","theme":"light","preferredEditorType":"sv","showInvisibleChar":false,"formatCode":true,"coin_now":7480,"coin_all":7490,"displayName":"","rpInfo":{"problem":227.88533380626842},"nAccept":769,"nSubmit":791,"nLiked":0,"rp":227.88533380626842,"rank":20,"level":7,"join":true,"avatarUrl":"/file/339/.avatar.png"}';
</script>
</head>
<body>
<script type="text/javascript" src="/resource/058f6069/entry.js"></script>
<script type="text/javascript" src="/resource/4.58.3/lang-zh.js"></script>
<script type="text/javascript" src="/hydro-4.58.3.js"></script>
<nav class="nav slideout-menu" id="menu">
<div class="row"><div class="columns clearfix">
<ol class="nav__list nav__list--main clearfix">
<li class="nav__list-item">
<a href="/"><img class="nav__logo" src="/qonnwolf_new.png"></a>
</li> <li class="nav__list-item">
<a href="/" class="nav__item">
首页
</a>
</li>
<li class="nav__list-item">
<a href="/course" class="nav__item">
课程
</a>
</li>
<li class="nav__list-item">
<a href="/p" class="nav__item nav--active">
题库
</a>
</li>
<li class="nav__list-item">
<a href="/training" class="nav__item">
训练
</a>
</li>
<li class="nav__list-item">
<a href="/contest" class="nav__item">
比赛
</a>
</li>
<li class="nav__list-item">
<a href="/homework" class="nav__item">
作业
</a>
</li>
<li class="nav__list-item">
<a href="/record?uidOrName=339" class="nav__item">
评测记录
</a>
</li>
<li class="nav__list-item">
<a href="/domain/dashboard" class="nav__item">
管理域
</a>
</li>
</ol>
<ol class="nav__list nav__list--secondary clearfix">
<li class="nav__list-item" data-dropdown-pos="bottom right" data-dropdown-custom-class="nav__dropdown" data-dropdown-target="#menu-nav-user" data-dropdown-disabledconstrainToWindow data-dropdown-trigger-desktop-only>
<a href="/user/339" class="nav__item">橙子老师 <span class="icon icon-expand_more nojs--hide"></span></a>
<ol class="dropdown-target menu" id="menu-nav-user">
<li class="menu__item">
<a href="/user/339" class="menu__link">
<span class="icon icon-account--circle"></span> 我的资料
</a>
</li>
<li class="menu__item">
<a href="/home/messages" class="menu__link">
<span class="icon icon-comment--multiple"></span> 站内消息
</a>
</li>
<li class="menu__seperator"></li>
<li class="menu__item">
<a href="/home/settings/domain" class="menu__link">
<span class="icon icon-web"></span> @ 穹狼科创
</a>
</li>
<li class="menu__seperator"></li>
<li class="menu__item">
<a href="/home/settings/account" class="menu__link">
<span class="icon icon-wrench"></span> 账户设置
</a>
</li>
<li class="menu__item">
<a href="/home/settings/preference" class="menu__link">
<span class="icon icon-sliders"></span> 偏好设置
</a>
</li>
<li class="menu__item">
<a href="/home/security" class="menu__link">
<span class="icon icon-security"></span> 安全设置
</a>
</li>
<li class="menu__seperator"></li>
<li class="menu__item">
<a href="/home/domain" class="menu__link">
<span class="icon icon-web"></span> 我的域
</a>
</li>
<li class="menu__seperator"></li>
<li class="menu__item">
<a href="/logout" class="menu__link" name="nav_logout">
<span class="icon icon-logout"></span> 登出
</a>
</li>
</ol>
</li>
</ol>
</div></div>
</nav>
<nav class="nav--shadow"></nav>
<div class="slideout-panel" id="panel">
<div class="slideout-overlay"></div>
<div class="header--mobile">
<div class="row"><div class="columns clearfix">
<div class="float-left">
<a class="header--mobile__domain" href="/" target="_self">
<img src="/qonnwolf_new.png">
</a>
</div>
<div class="float-right">
<button type="button" class="header__hamburger">
<div class="hamburger hamburger--spin">
<span class="hamburger-box">
<span class="hamburger-inner"></span>
</span>
</div>
</button>
</div>
</div></div>
</div>
<div class="main">
<script>
</script>
<meta property="og:locale" content="zh" />
<meta property="og:title" content="S0401P3. 小杨的进制数位 - 穹狼科创" />
<meta property="og:description" content="题目描述
小杨在学进制转换。给定十进制数 n 和目标进制 k(2≤k≤16),请把 n 转换成 k 进制表示,并统计这个表示中的字符构成:
1. k 进制表示(超过 9 的数位用大写字母 A~F 表示..." />
<div class="row" data-sticky-parent>
<div class="medium-9 columns">
<div class="section">
<div class="section__header">
<h1 class="section__title">
<a href="/record/6a97dfed8499477a04187630">
<span class="icon record-status--icon pass"></span>
<span class="record-status--text pass">100</span>
</a>
<form class="form--inline" action="" method="post">
<input type="hidden" name="star" value="true">
<input type="hidden" name="operation" value="star">
<button class="star" type="submit">
<span class="starred--hide"><span class="icon icon-star--outline" data-tooltip="收藏"></span></span>
<span class="starred--show"><span class="icon icon-star" data-tooltip="取消收藏"></span></span>
</button>
</form>
#S0401P3. 小杨的进制数位
</h1>
</div>
<div class="section__body">
<ul class="problem__tags">
<span class="problem__tag-item">ID: 6777</span>
<span class="problem__tag-item icon icon-book">传统题</span>
<span class="problem__tag-item icon icon-stopwatch">1000ms</span>
<span class="problem__tag-item icon icon-comparison">256MiB</span>
<a class="problem__tag-item interactive" href="/record?pid=6777">尝试: 4</a>
<a class="problem__tag-item interactive" href="/record?pid=6777&amp;status=1">已通过: 1</a>
<span class="problem__tag-item">难度: 10</span>
<span class="problem__tag-item interactive">上传者: <span class="user-profile-link">
<img class="small user-profile-avatar v-center" loading="lazy" src="//cravatar.cn/avatar/6d2c246e0e74c79036c564ac6e90f1f5?d=mm&amp;s=64" width="20" height="20">
<a class="user-profile-name uname--lv10" href="/user/531">
moss
</a>
</span>
</span>
<span name="show_tags" class="problem__tag-item interactive nojs--hide icon icon-tag">标签&gt;</span><span class="problem__tag-item tags hasjs--hide">进制转换</span><span class="problem__tag-item tags hasjs--hide">数位分解</span><span class="problem__tag-item tags hasjs--hide">字符串</span> </ul>
</div>
</div>
<div class="section">
<div class="problem-content-container"><div class="problem-content" data-marker-enabled>
<div class="section__header non-scratchpad--hide">
<h1 class="section__title">小杨的进制数位</h1>
</div>
<div class="section__body typo richmedia" data-fragment-id="problem-description">
<h2 id="%E9%A2%98%E7%9B%AE%E6%8F%8F%E8%BF%B0" tabindex="-1">题目描述</h2>
<p>小杨在学进制转换。给定十进制数 <span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mi>n</mi></mrow><annotation encoding="application/x-tex">n</annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:0.4306em;"></span><span class="mord mathnormal">n</span></span></span></span> 和目标进制 <span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mi>k</mi></mrow><annotation encoding="application/x-tex">k</annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:0.6944em;"></span><span class="mord mathnormal" style="margin-right:0.0315em;">k</span></span></span></span>(<span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mn>2</mn><mo>≤</mo><mi>k</mi><mo>≤</mo><mn>16</mn></mrow><annotation encoding="application/x-tex">2 \le k \le 16</annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:0.7804em;vertical-align:-0.136em;"></span><span class="mord">2</span><span class="mspace" style="margin-right:0.2778em;"></span><span class="mrel">≤</span><span class="mspace" style="margin-right:0.2778em;"></span></span><span class="base"><span class="strut" style="height:0.8304em;vertical-align:-0.136em;"></span><span class="mord mathnormal" style="margin-right:0.0315em;">k</span><span class="mspace" style="margin-right:0.2778em;"></span><span class="mrel">≤</span><span class="mspace" style="margin-right:0.2778em;"></span></span><span class="base"><span class="strut" style="height:0.6444em;"></span><span class="mord">16</span></span></span></span>),请把 <span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mi>n</mi></mrow><annotation encoding="application/x-tex">n</annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:0.4306em;"></span><span class="mord mathnormal">n</span></span></span></span> 转换成 <span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mi>k</mi></mrow><annotation encoding="application/x-tex">k</annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:0.6944em;"></span><span class="mord mathnormal" style="margin-right:0.0315em;">k</span></span></span></span> 进制表示,并统计这个表示中的字符构成:</p>
<ol>
<li><span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mi>k</mi></mrow><annotation encoding="application/x-tex">k</annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:0.6944em;"></span><span class="mord mathnormal" style="margin-right:0.0315em;">k</span></span></span></span> 进制表示(超过 <span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mn>9</mn></mrow><annotation encoding="application/x-tex">9</annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:0.6444em;"></span><span class="mord">9</span></span></span></span> 的数位用大写字母 <code>A</code>~<code>F</code> 表示 <span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mn>10</mn></mrow><annotation encoding="application/x-tex">10</annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:0.6444em;"></span><span class="mord">10</span></span></span></span>~<span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mn>15</mn></mrow><annotation encoding="application/x-tex">15</annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:0.6444em;"></span><span class="mord">15</span></span></span></span>);</li>
<li>表示中<strong>数字字符</strong>(<code>0</code>~<code>9</code>)的个数;</li>
<li>表示中<strong>字母字符</strong>(<code>A</code>~<code>F</code>)的个数。</li>
</ol>
<p>例如 <span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mi>n</mi><mo>=</mo><mn>255</mn></mrow><annotation encoding="application/x-tex">n=255</annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:0.4306em;"></span><span class="mord mathnormal">n</span><span class="mspace" style="margin-right:0.2778em;"></span><span class="mrel">=</span><span class="mspace" style="margin-right:0.2778em;"></span></span><span class="base"><span class="strut" style="height:0.6444em;"></span><span class="mord">255</span></span></span></span>、<span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mi>k</mi><mo>=</mo><mn>16</mn></mrow><annotation encoding="application/x-tex">k=16</annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:0.6944em;"></span><span class="mord mathnormal" style="margin-right:0.0315em;">k</span><span class="mspace" style="margin-right:0.2778em;"></span><span class="mrel">=</span><span class="mspace" style="margin-right:0.2778em;"></span></span><span class="base"><span class="strut" style="height:0.6444em;"></span><span class="mord">16</span></span></span></span> 时表示为 <code>FF</code>,数字字符 <span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mn>0</mn></mrow><annotation encoding="application/x-tex">0</annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:0.6444em;"></span><span class="mord">0</span></span></span></span> 个、字母字符 <span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mn>2</mn></mrow><annotation encoding="application/x-tex">2</annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:0.6444em;"></span><span class="mord">2</span></span></span></span> 个。</p>
<h2 id="%E8%BE%93%E5%85%A5%E6%A0%BC%E5%BC%8F" tabindex="-1">输入格式</h2>
<p>一行两个整数 <span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mi>n</mi><mo separator="true">,</mo><mi>k</mi></mrow><annotation encoding="application/x-tex">n, k</annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:0.8889em;vertical-align:-0.1944em;"></span><span class="mord mathnormal">n</span><span class="mpunct">,</span><span class="mspace" style="margin-right:0.1667em;"></span><span class="mord mathnormal" style="margin-right:0.0315em;">k</span></span></span></span>,用空格隔开。</p>
<h2 id="%E8%BE%93%E5%87%BA%E6%A0%BC%E5%BC%8F" tabindex="-1">输出格式</h2>
<p>三行:<span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mi>k</mi></mrow><annotation encoding="application/x-tex">k</annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:0.6944em;"></span><span class="mord mathnormal" style="margin-right:0.0315em;">k</span></span></span></span> 进制表示、数字字符个数、字母字符个数。</p>
<h2 id="%E6%95%B0%E6%8D%AE%E8%8C%83%E5%9B%B4" tabindex="-1">数据范围</h2>
<ul>
<li><span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mn>0</mn><mo>≤</mo><mi>n</mi><mo>≤</mo><msup><mn>10</mn><mn>9</mn></msup></mrow><annotation encoding="application/x-tex">0 \le n \le 10^9</annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:0.7804em;vertical-align:-0.136em;"></span><span class="mord">0</span><span class="mspace" style="margin-right:0.2778em;"></span><span class="mrel">≤</span><span class="mspace" style="margin-right:0.2778em;"></span></span><span class="base"><span class="strut" style="height:0.7719em;vertical-align:-0.136em;"></span><span class="mord mathnormal">n</span><span class="mspace" style="margin-right:0.2778em;"></span><span class="mrel">≤</span><span class="mspace" style="margin-right:0.2778em;"></span></span><span class="base"><span class="strut" style="height:0.8141em;"></span><span class="mord">1</span><span class="mord"><span class="mord">0</span><span class="msupsub"><span class="vlist-t"><span class="vlist-r"><span class="vlist" style="height:0.8141em;"><span style="top:-3.063em;margin-right:0.05em;"><span class="pstrut" style="height:2.7em;"></span><span class="sizing reset-size6 size3 mtight"><span class="mord mtight">9</span></span></span></span></span></span></span></span></span></span></span></li>
<li><span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mn>2</mn><mo>≤</mo><mi>k</mi><mo>≤</mo><mn>16</mn></mrow><annotation encoding="application/x-tex">2 \le k \le 16</annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:0.7804em;vertical-align:-0.136em;"></span><span class="mord">2</span><span class="mspace" style="margin-right:0.2778em;"></span><span class="mrel">≤</span><span class="mspace" style="margin-right:0.2778em;"></span></span><span class="base"><span class="strut" style="height:0.8304em;vertical-align:-0.136em;"></span><span class="mord mathnormal" style="margin-right:0.0315em;">k</span><span class="mspace" style="margin-right:0.2778em;"></span><span class="mrel">≤</span><span class="mspace" style="margin-right:0.2778em;"></span></span><span class="base"><span class="strut" style="height:0.6444em;"></span><span class="mord">16</span></span></span></span></li>
</ul>
<h2 id="%E6%A0%B7%E4%BE%8B-%231" tabindex="-1">样例 #1</h2>
<pre><code class="language-input1">255 16
</code></pre>
<pre><code class="language-output1">FF
0
2
</code></pre>
<h2 id="%E6%A0%B7%E4%BE%8B-%232" tabindex="-1">样例 #2</h2>
<pre><code class="language-input2">10 2
</code></pre>
<pre><code class="language-output2">1010
4
0
</code></pre>
</div> </div></div>
</div>
</div>
<div class="medium-3 columns"><div data-sticky="large">
<div class="section side section--problem-sidebar">
<div>
<ol class="menu">
<li class="menu__item scratchpad--hide nojs--hide"><a class="menu__link highlight" name="problem-sidebar__open-scratchpad" href="javascript:;" data-global-hotkey="alt+e">
<span class="icon icon-enlarge"></span> 进入在线编程模式 (Alt+E)
</a></li>
<li class="menu__item non-scratchpad--hide"><a class="menu__link" name="problem-sidebar__quit-scratchpad" href="javascript:;" data-global-hotkey="alt+q">
<span class="icon icon-enlarge"></span> 退出在线编程模式 (Alt+Q)
</a></li>
<li class="menu__item scratchpad--hide"><a class="menu__link" href="/p/S0401P3/submit">
<span class="icon icon-send"></span> 递交
</a></li>
<li class="menu__item">
<form method="post" action="/p/6777">
<input type="hidden" name="operation" value="rejudge">
<button type="submit" class="menu__link" name="problem-sidebar__rejudge">
<span class="icon icon-refresh"></span> 重测整题
</button>
</form>
</li>
<li class="menu__seperator"></li>
<li class="menu__item"><a class="menu__link" href="/p/S0401P3/solution">
<span class="icon icon-comment--text"></span> 题解 (0) </a></li>
<li class="menu__item"><a class="menu__link" href="/p/S0401P3/files">
<span class="icon icon-file"></span> 文件
</a></li>
<li class="menu__item"><a class="menu__link" href="/p/S0401P3/stat">
<span class="icon icon-statistics"></span> 统计
</a></li>
<li class="menu__seperator"></li>
<li class="menu__item"><a class="menu__link" href="/p/S0401P3/edit">
<span class="icon icon-edit"></span> 编辑
</a></li>
<li class="menu__item"><a class="menu__link" href="/p/S0401P3/config">
<span class="icon icon-settings"></span> 评测设置
</a></li>
<li class="menu__seperator nojs--hide"></li>
<li class="menu__item nojs--hide"><a class="menu__link" href="javascript:;" name="problem-sidebar__download">
<span class="icon icon-download"></span> 下载
</a></li>
<li class="menu__item nojs--hide"><a class="menu__link" href="javascript:;" name="problem-sidebar__copy">
<span class="icon icon-copy"></span> 复制
</a></li>
</ol>
</div>
</div>
<div class="section side">
<div class="section__header">
<h1 class="section__title">相关</h1>
</div>
<div class="section__body typo">
<p>在以下作业中: </p><p><a href="/homework/6a8c6a8b8499477a04169f85">01 基础回顾 - 课堂练习</a></p> </div>
</div>
</div></div>
</div>
<div style="display:none" class="outer-loader-container"><div class="loader"></div></div>
<div class="scratchpad-container" style="display:none">
<div style="display:none" class="loader-container"><div class="loader"></div></div>
<div id="scratchpad" style="opacity:0"></div>
</div>
</div>
<div class="footer">
<div class="row">
<div class="columns">
<div class="footer__extra-link clearfix">
<div class="footer__extra-left">
<ol class="clearfix">
<li class="footer__extra-link-item"><a href="/record">评测队列</a></li>
<li class="footer__extra-link-item"><a href="/status">服务状态</a></li>
<li class="footer__extra-link-item">
<a href="/legacy?legacy=true">兼容模式</a>
</li>
<li class="footer__extra-link-item nojs--hide" data-dropdown-target="#menu-footer-theme">
<span><span class="icon icon-global"></span> 主题 <span
class="icon icon-expand_less"></span></span>
<ol class="dropdown-target menu" id="menu-footer-theme">
<li class="menu__item"><a class="menu__link" href="/set_theme/light">亮色</a></li>
<li class="menu__item"><a class="menu__link" href="/set_theme/dark">暗色</a></li>
</ol>
</li>
</ol>
</div>
<div class="footer__extra-right">
<ol class="clearfix"><li class="footer__extra-link-item"></li><li class="footer__extra-link-item"></li><li class="footer__extra-link-item">Worker 0, 37ms</li>
<!-- Prepare 4ms -->
<!-- Method 2ms -->
<li class="footer__extra-link-item">Powered by <a href="https://hydro.js.org">Hydro v5.0.3</a> </li>
</ol>
</div>
</div>
</div>
</div>
</div></div>
<script>
var UiContextNew = '{"problemId":"S0401P3","problemNumId":6777,"codeLang":"cc.cc14o2","codeTemplate":"","pdoc":{"_id":"6a8cefb88499477a0416ac36","content":"{\\"zh\\":\\"## \u9898\u76EE\u63CF\u8FF0\\\\n\\\\n\u5C0F\u6768\u5728\u5B66\u8FDB\u5236\u8F6C\u6362\u3002\u7ED9\u5B9A\u5341\u8FDB\u5236\u6570 $n$ \u548C\u76EE\u6807\u8FDB\u5236 $k$\uFF08$2 \\\\\\\\le k \\\\\\\\le 16$\uFF09\uFF0C\u8BF7\u628A $n$ \u8F6C\u6362\u6210 $k$ \u8FDB\u5236\u8868\u793A\uFF0C\u5E76\u7EDF\u8BA1\u8FD9\u4E2A\u8868\u793A\u4E2D\u7684\u5B57\u7B26\u6784\u6210\uFF1A\\\\n\\\\n1. $k$ \u8FDB\u5236\u8868\u793A\uFF08\u8D85\u8FC7 $9$ \u7684\u6570\u4F4D\u7528\u5927\u5199\u5B57\u6BCD `A`~`F` \u8868\u793A $10$~$15$\uFF09\uFF1B\\\\n2. \u8868\u793A\u4E2D**\u6570\u5B57\u5B57\u7B26**\uFF08`0`~`9`\uFF09\u7684\u4E2A\u6570\uFF1B\\\\n3. \u8868\u793A\u4E2D**\u5B57\u6BCD\u5B57\u7B26**\uFF08`A`~`F`\uFF09\u7684\u4E2A\u6570\u3002\\\\n\\\\n\u4F8B\u5982 $n=255$\u3001$k=16$ \u65F6\u8868\u793A\u4E3A `FF`\uFF0C\u6570\u5B57\u5B57\u7B26 $0$ \u4E2A\u3001\u5B57\u6BCD\u5B57\u7B26 $2$ \u4E2A\u3002\\\\n\\\\n## \u8F93\u5165\u683C\u5F0F\\\\n\\\\n\u4E00\u884C\u4E24\u4E2A\u6574\u6570 $n, k$\uFF0C\u7528\u7A7A\u683C\u9694\u5F00\u3002\\\\n\\\\n## \u8F93\u51FA\u683C\u5F0F\\\\n\\\\n\u4E09\u884C\uFF1A$k$ \u8FDB\u5236\u8868\u793A\u3001\u6570\u5B57\u5B57\u7B26\u4E2A\u6570\u3001\u5B57\u6BCD\u5B57\u7B26\u4E2A\u6570\u3002\\\\n\\\\n## \u6570\u636E\u8303\u56F4\\\\n\\\\n- $0 \\\\\\\\le n \\\\\\\\le 10^9$\\\\n- $2 \\\\\\\\le k \\\\\\\\le 16$\\\\n\\\\n## \u6837\u4F8B #1\\\\n\\\\n```input1\\\\n255 16\\\\n```\\\\n\\\\n```output1\\\\nFF\\\\n0\\\\n2\\\\n```\\\\n\\\\n## \u6837\u4F8B #2\\\\n\\\\n```input2\\\\n10 2\\\\n```\\\\n\\\\n```output2\\\\n1010\\\\n4\\\\n0\\\\n```\\\\n\\"}","owner":531,"domainId":"system","docType":10,"docId":6777,"title":"\u5C0F\u6768\u7684\u8FDB\u5236\u6570\u4F4D","tag":["\u8FDB\u5236\u8F6C\u6362","\u6570\u4F4D\u5206\u89E3","\u5B57\u7B26\u4E32"],"hidden":true,"nSubmit":4,"nAccept":1,"data":[{"_id":"generate_testdata.py","name":"generate_testdata.py","size":1686,"lastModified":"2026-08-25T01:28:24.246Z","etag":"L2RhdGEvZmlsZS9oeWRyby9hbnIva3RseHFzeXEwcGhoa2liYXN6c2d6LnB5"},{"_id":"std.cpp","name":"std.cpp","size":826,"lastModified":"2026-08-25T01:28:24.250Z","etag":"L2RhdGEvZmlsZS9oeWRyby8wOTYvam96NDRvOTFoY2M4Z2VwcjZ5dXZ6LmNwcA=="},{"_id":"test1.in","name":"test1.in","size":7,"lastModified":"2026-08-25T01:28:24.254Z","etag":"L2RhdGEvZmlsZS9oeWRyby83azMvNW9mbmlydHI3cG50b2J4eXBhcGhvLmlu"},{"_id":"test1.out","name":"test1.out","size":7,"lastModified":"2026-08-25T01:28:24.258Z","etag":"L2RhdGEvZmlsZS9oeWRyby94bXovdW55dGRyaXFmMnJncHowdXRhdzd5Lm91dA=="},{"_id":"test2.in","name":"test2.in","size":5,"lastModified":"2026-08-25T01:28:24.263Z","etag":"L2RhdGEvZmlsZS9oeWRyby8zeTEvZWxpcTM4dWgwYng2bGdtNGV2ZWN2Lmlu"},{"_id":"test2.out","name":"test2.out","size":9,"lastModified":"2026-08-25T01:28:24.268Z","etag":"L2RhdGEvZmlsZS9oeWRyby8yamsvMDB2NG9wYjRkZW51OG54dmZqZWk4Lm91dA=="},{"_id":"test3.in","name":"test3.in","size":5,"lastModified":"2026-08-25T01:28:24.274Z","etag":"L2RhdGEvZmlsZS9oeWRyby9ndHEvbWJ4cG5zcnZlbDZ1ZXk3ZWwxYzlvLmlu"},{"_id":"test3.out","name":"test3.out","size":6,"lastModified":"2026-08-25T01:28:24.277Z","etag":"L2RhdGEvZmlsZS9oeWRyby9mYmUvOHF3Y292d3BwZGttdnV3MHJldmJkLm91dA=="},{"_id":"test4.in","name":"test4.in","size":14,"lastModified":"2026-08-25T01:28:24.282Z","etag":"L2RhdGEvZmlsZS9oeWRyby8wb3ovNjAxMXN5Y2t2bXFjdHZoZGxkdTdyLmlu"},{"_id":"test4.out","name":"test4.out","size":13,"lastModified":"2026-08-25T01:28:24.286Z","etag":"L2RhdGEvZmlsZS9oeWRyby8wbWIvdzVtbjQ5eHZ1eHJxcWpodGE1emFoLm91dA=="},{"_id":"test5.in","name":"test5.in","size":12,"lastModified":"2026-08-25T01:28:24.289Z","etag":"L2RhdGEvZmlsZS9oeWRyby9ld2kvZHZnODlzazhqZnh5YnVtbXNpZzF0Lmlu"},{"_id":"test5.out","name":"test5.out","size":16,"lastModified":"2026-08-25T01:28:24.294Z","etag":"L2RhdGEvZmlsZS9oeWRyby9kYzAvYTJydXFtcGRrODY5b3IyanY3c3phLm91dA=="},{"_id":"test6.in","name":"test6.in","size":13,"lastModified":"2026-08-25T01:28:24.297Z","etag":"L2RhdGEvZmlsZS9oeWRyby9kdW8vNzF5eW8wcm10YmJqbmt0MGIzd3R2Lmlu"},{"_id":"test6.out","name":"test6.out","size":12,"lastModified":"2026-08-25T01:28:24.301Z","etag":"L2RhdGEvZmlsZS9oeWRyby9udnEvcDVkc3VheTB2cWoyenM3MnlkbHo0Lm91dA=="}],"additional_file":[],"pid":"S0401P3","difficulty":0,"html":false,"stats":{"WA":3,"s16":1,"s83":2,"AC":1,"s100":1},"config":{"count":6,"memoryMin":256,"memoryMax":256,"timeMin":1000,"timeMax":1000,"type":"default","langs":["bash","c","cc","cc.cc98","cc.cc98o2","cc.cc11","cc.cc11o2","cc.cc14","cc.cc14o2","cc.cc17","cc.cc17o2","cc.cc20","cc.cc20o2","pas","java","kt","kt.jvm","py","py.py2","py.py3","py.pypy3","php","rs","hs","js","go","rb","cs","r"]}},"canViewRecord":true,"postSubmitUrl":"/p/6777/submit","getSubmissionsUrl":"/record?fullStatus=true&pid=6777","getRecordDetailUrl":"/record/%7Brid%7D","pretestConnUrl":"record-conn?pretest=1&uidOrName=339&pid=6777&domainId=system"}';
var UserContextNew = '{}';
</script>
</body>
</html>