摘要: c1847 更好的博客阅读 一道简单的字符串比较。 枚举每一位,进行累加。 这里用到了三目运算符。 所以代码如下: cpp include include include include include include include include include include include 阅读全文
posted @ 2020-03-15 22:56 CConstantine 阅读(118) 评论(0) 推荐(0)
摘要: c1477 更好的博客阅读 这种题目显然是签到题,简单的字符串比较。 但要注意代码量。 我们不能傻傻打几重循环,显然,数组是一个更好地选择。 代码如下: cpp include include include include include using std::cin;using std::cer 阅读全文
posted @ 2020-03-11 22:44 CConstantine 阅读(120) 评论(0) 推荐(0)
摘要: c1023 更好的博客阅读 这道题教会了我们观察。 理解题意后得到要求我们输出 $$ 1+2+3+4+\cdots +n+n 1+\cdots + 1 $$ 自然想起等差数列和的公式 $$ S = \frac{(1+n)n}{2} $$ 自然得到 $$ ans = (n+1)n n $$ 下附代码 阅读全文
posted @ 2020-02-29 18:01 CConstantine 阅读(137) 评论(0) 推荐(0)