摘要:
思路 设t = A + B,将每一次t % d的结果保存在int类型的数组s中 然后将t / d,直到 t 等于 0为止 此时s中保存的就是 t 在 D 进制下每一位的结果的倒序 最后倒序输出s数组 #include <iostream> using namespace std; int main( 阅读全文
posted @ 2020-10-21 15:08
cxc1357
阅读(86)
评论(0)
推荐(0)
摘要:
思路 创建10个元素数组,保存0到9出现的次数 输出非零项 #include <iostream> using namespace std; int main() { string s; cin >> s; int a[10] = {0}; for (int i = 0; i < s.length( 阅读全文
posted @ 2020-10-21 15:02
cxc1357
阅读(91)
评论(0)
推荐(0)
摘要:
思路 根据月饼的总价和数量计算出每一种月饼的单价 用结构体存储月饼的数量,总价,单价;用结构体数组存储月饼结构体 将月饼数组按照单价从大到小排序 根据需求量need的大小,从单价最大的月饼开始售卖 将销售掉这种月饼的价格累加到result中,最后输出result #include <iostream 阅读全文
posted @ 2020-10-21 14:47
cxc1357
阅读(117)
评论(0)
推荐(0)
摘要:
思路 以字符串接收数据 sort():数组排序,倒序排序,重新写比较函数 s.insert(0, 4 – s.length(), ‘0’):用来给不足4位的时候前面补0 do while语句,输入6174时也计算一次 #include <iostream> #include <algorithm> 阅读全文
posted @ 2020-10-21 14:33
cxc1357
阅读(118)
评论(0)
推荐(0)

浙公网安备 33010602011771号