题解:T716929 新年

· · 题解

:::align{center}

T716929 题解

𝐏𝐚𝐫𝐭〔 𝟎𝟏 〕—— 理解题目

给定一个字符串 \small\texttt{[此处应有名字]} ,然后求这个字符串里质数位的数字所对应的字符并一概输出。

𝐏𝐚𝐫𝐭〔 𝟎𝟐 〕—— 解决题目

bool is_prime(int n) { if (n <= 1) { return false; } if (n == 2) { return true; } if (n % 2 == 0) { return false; } for (int i = 3; i * i <= n; i += 2) { if (n % i == 0) { return false; } } return true; }

string s;

int main() { cin >> s;

for (int idx = 0; idx < s.size(); ++idx) {
    if (is_prime(idx + 1)) {
        cout << s[idx];
    }
}

return 0;

}


:::

## 𝐏𝐚𝐫𝐭〔 𝟎𝟰 〕—— 题外话
:::align{center}
$\footnotesize
\textcolor{#18f4ef}{曈}
\textcolor{#21e6e5}{曈}
\textcolor{#2ad8db}{晓}
\textcolor{#34cad1}{日}
\textcolor{#3dbdc7}{,}
\textcolor{#47afbd}{灼}
\textcolor{#50a1b3}{灼}
\textcolor{#5a93a9}{华}
\textcolor{#63869f}{灯}
\textcolor{#6c7895}{,}
\textcolor{#766a8b}{喧}
\textcolor{#7f5c81}{喧}
\textcolor{#894f77}{笑}
\textcolor{#92416d}{语}
\textcolor{#9c3363}{盈}
\textcolor{#a52559}{路}
\textcolor{#af1850}{。}
$     
$\footnotesize
\textcolor{#18f4ef}{腊}
\textcolor{#25e0e0}{尽}
\textcolor{#33ccd2}{春}
\textcolor{#41b8c3}{回}
\textcolor{#4ea4b5}{风}
\textcolor{#5c90a6}{软}
\textcolor{#6a7c98}{,}
\textcolor{#786889}{暖}
\textcolor{#85547b}{香}
\textcolor{#93406c}{暗}
\textcolor{#a12c5e}{度}
\textcolor{#af1850}{。}
$     
$\footnotesize
\textcolor{#18f4ef}{屠}
\textcolor{#22e5e4}{苏}
\textcolor{#2cd6d9}{浅}
\textcolor{#36c8cf}{斟}
\textcolor{#40b9c4}{共}
\textcolor{#4aaaba}{饮}
\textcolor{#549caf}{,}
\textcolor{#5e8da4}{贺}
\textcolor{#687e9a}{新}
\textcolor{#72708f}{正}
\textcolor{#7c6185}{、}
\textcolor{#86527a}{岁}
\textcolor{#90446f}{华}
\textcolor{#9a3565}{相}
\textcolor{#a4265a}{付}
\textcolor{#af1850}{。}
$   
$\footnotesize
\textcolor{#18f4ef}{贴}
\textcolor{#22e4e3}{吉}
\textcolor{#2dd4d8}{联}
\textcolor{#38c4cc}{,}
\textcolor{#43b5c1}{挂}
\textcolor{#4da5b6}{红}
\textcolor{#5895aa}{灯}
\textcolor{#63869f}{、}
\textcolor{#6e7694}{醉}
\textcolor{#796688}{了}
\textcolor{#83567d}{满}
\textcolor{#8e4772}{堂}
\textcolor{#993766}{欢}
\textcolor{#a4275b}{聚}
\textcolor{#af1850}{。}
$   
$\footnotesize
\textcolor{#18f4ef}{旧}
\textcolor{#20e7e5}{岁}
\textcolor{#29dadc}{烦}
\textcolor{#32cdd2}{忧}
\textcolor{#3bc0c9}{皆}
\textcolor{#44b3c0}{去}
\textcolor{#4da6b6}{,}
\textcolor{#5699ad}{欣}
\textcolor{#5f8ca4}{所}
\textcolor{#677f9a}{见}
\textcolor{#707291}{、}
\textcolor{#796588}{山}
\textcolor{#82587e}{河}
\textcolor{#8b4b75}{尽}
\textcolor{#943e6c}{呈}
\textcolor{#9d3162}{芳}
\textcolor{#a62459}{絮}
\textcolor{#af1850}{。}
$    
$\footnotesize
\textcolor{#18f4ef}{守}
\textcolor{#25e0e0}{岁}
\textcolor{#33ccd2}{围}
\textcolor{#41b8c3}{炉}
\textcolor{#4ea4b5}{,}
\textcolor{#5c90a6}{细}
\textcolor{#6a7c98}{说}
\textcolor{#786889}{家}
\textcolor{#85547b}{常}
\textcolor{#93406c}{温}
\textcolor{#a12c5e}{煦}
\textcolor{#af1850}{。}
$     
$\footnotesize
\textcolor{#18f4ef}{祥}
\textcolor{#22e5e4}{光}
\textcolor{#2cd6d9}{漫}
\textcolor{#36c8cf}{笼}
\textcolor{#40b9c4}{万}
\textcolor{#4aaaba}{户}
\textcolor{#549caf}{,}
\textcolor{#5e8da4}{盼}
\textcolor{#687e9a}{来}
\textcolor{#72708f}{朝}
\textcolor{#7c6185}{、}
\textcolor{#86527a}{福}
\textcolor{#90446f}{泽}
\textcolor{#9a3565}{常}
\textcolor{#a4265a}{驻}
\textcolor{#af1850}{。}
$    
$\footnotesize
\textcolor{#18f4ef}{此}
\textcolor{#25e0e0}{良}
\textcolor{#33ccd2}{辰}
\textcolor{#41b8c3}{,}
\textcolor{#4ea4b5}{愿}
\textcolor{#5c90a6}{岁}
\textcolor{#6a7c98}{岁}
\textcolor{#786889}{平}
\textcolor{#85547b}{安}
\textcolor{#93406c}{顺}
\textcolor{#a12c5e}{遂}
\textcolor{#af1850}{。}
$
:::
::::epigraph[——@\_\_\_awa\_\_\_]
::::