题解 3008: 买笔 摘要:解题思路:要买最多的笔,肯定优先买4元最便宜的,当钱不够买4元笔的时候就撤回之前买的一些笔。转而买5元和6元的笔让钱凑到零注意事项:可以定义多个变量参考代码:方法一:(if语句)#include <i…… 题解列表 2024年01月15日 0 点赞 0 评论 654 浏览 评分:0.0
题解 3008: 买笔 摘要:解题思路:注意事项:?参考代码:#include <iostream>using namespace std;int main(){ int x; cin>>x; if(x%4==…… 题解列表 2024年01月07日 0 点赞 1 评论 606 浏览 评分:9.9
c++买笔c++买笔c++买笔c++买笔c++买笔 摘要:解题思路:注意事项:参考代码:#include <iostream>using namespace std;int main(){ int x; cin>>x; if(x%4==0)…… 题解列表 2024年01月07日 0 点赞 1 评论 535 浏览 评分:6.0
买笔买笔30083008 摘要:解题思路:#include <iostream>using namespace std;int main(int argc, char** argv){int x,y,a,b,c;cin>>x;c=x…… 题解列表 2024年01月07日 0 点赞 0 评论 457 浏览 评分:2.0
3008: 买笔 买个鸡脖 摘要:解题思路:注意事项:需要想到多种可能参考代码:#include <bits/stdc++.h>using namespace std;int main(){ int x; cin>>x; …… 题解列表 2024年01月07日 0 点赞 0 评论 451 浏览 评分:0.0
编写题解 3008: 买笔(if语句解法) 解题思路:若想让笔的数量最大,应优先购买4元的。以4为基准求余:剩1元,则4元钱的笔少买1支,换成1支5元笔;剩2元,则4元钱的笔少买1支,换成1支6元笔;剩3元,则4元钱的笔少买2支,换成1支5元笔和1支6元笔;注意事项:参考代码:#includeusingnamespacest 题解列表 2024年01月07日 0 点赞 0 评论 427 浏览 评分:0.0
3008: 买笔3008: 买笔3008: 买笔3008: 买笔3008: 买笔3008: 买笔3008: 买笔3008: 买笔3008: 买笔3008: 买笔3008: 买笔3008: 买笔3008 摘要:解题思路:注意事项:参考代码:#include <iostream>using namespace std;int main(int argc, char** argv){int x,y,a,b,c;…… 题解列表 2024年01月07日 0 点赞 1 评论 720 浏览 评分:9.9
题解 3008: 买笔 摘要:解题思路:注意事项:参考代码:#include <bits/stdc++.h>using namespace std;int main(){ int x; cin>>x; if(x%…… 题解列表 2024年01月07日 0 点赞 0 评论 413 浏览 评分:0.0
题解 3008: 买笔 解题思路:注意事项:若想让笔的数量最大,应优先购买4元的。以4为基准求余:剩1元,则4元钱的笔少买1支,换成1支5元笔;剩2元,则4元钱的笔少买1支,换成1支6元笔;剩3元,则4元钱的笔少买2支,换成1支5元笔和1支6元笔;本题的主要思想是贪心算法(循环中的三块代码操作类似, 题解列表 2024年01月07日 0 点赞 0 评论 518 浏览 评分:9.9
3008: 买笔(超级简单) 摘要:解题思路:注意事项:参考代码:#include <bits/stdc++.h>using namespace std;int main(){ int a; cin>>a; int b…… 题解列表 2024年01月07日 0 点赞 1 评论 428 浏览 评分:9.9