3008: 班长用班费买笔 摘要:解题思路:尽量买四元的笔剩1元,则4元钱的笔少买1支,换成1支5元笔;剩2元,则4元钱的笔少买1支,换成1支6元笔;剩3元,则4元钱的笔少买2支,换成1支5元笔和1支6元笔;注意事项:参考代码:#in…… 题解列表 2024年11月24日 4 点赞 0 评论 459 浏览 评分:10.0
买笔期末来临了,班长小Q决定将剩余班费x元钱,用于购买若干支钢笔奖励给一些学习好、表现好的同学。已知商店里有三种钢笔,它们的单价为6元、5元和4元。小Q想买尽量多的笔(鼓励尽量多的同学),同时他又不想有剩余钱。请您编一程序,帮小Q制订出一种买笔的方案。 摘要:解题思路:按照要求全部买4元笔,剩下的钱用sum存储,观察到有0,1,2,3.四种情况,如果是剩0元,直接输出对应的0,0,x/4。如果剩1元,就少买一只四元笔,这样你有5元,也就是0,1,x/4-1…… 题解列表 2025年07月22日 3 点赞 0 评论 316 浏览 评分:10.0
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,…… 题解列表 2024年01月07日 0 点赞 0 评论 294 浏览 评分:9.9
题解 3008: 买笔 摘要:解题思路:注意事项:参考代码:#include <bits/stdc++.h>using namespace std;int main(){ int x,a,b; cin>>x; a…… 题解列表 2024年01月07日 0 点赞 0 评论 283 浏览 评分:9.9
3008: 买笔(超级简单) 摘要:解题思路:注意事项:参考代码:#include <bits/stdc++.h>using namespace std;int main(){ int a; cin>>a; int b…… 题解列表 2024年01月07日 0 点赞 1 评论 279 浏览 评分:9.9
题解 3008: 买笔 摘要:解题思路:注意事项:若想让笔的数量最大,应优先购买4元的。以4为基准求余:剩1元,则4元钱的笔少买1支,换成1支5元笔;剩2元,则4元钱的笔少买1支,换成1支6元笔;剩3元,则4元钱的笔少买2支,换成…… 题解列表 2024年01月07日 0 点赞 0 评论 307 浏览 评分:9.9
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 评论 537 浏览 评分:9.9
题解 3008: 买笔 摘要:解题思路:注意事项:?参考代码:#include <iostream>using namespace std;int main(){ int x; cin>>x; if(x%4==…… 题解列表 2024年01月07日 0 点赞 1 评论 396 浏览 评分:9.9
3008: 买笔(c++代码) 摘要:```cpp #include using namespace std; int main() { int x,a,b,c,i=0,j=0,k=0; cin>>x; …… 题解列表 2023年01月08日 1 点赞 0 评论 596 浏览 评分:8.8
编写题解 3008: 买笔, 摘要:解题思路:注意事项:只因你太美参考代码:#include <iostream>using namespace std;int main(int argc, char** argv) {int x,y,…… 题解列表 2023年02月06日 0 点赞 2 评论 399 浏览 评分:8.0