首页
DreamJudge
院校信息
考研初试
机试真题
讨论区
兑换中心
登录
注册
上岸
以下题解仅供学习参考使用。
抄袭、复制题解,以达到刷AC率/AC数量或其他目的的行为,在N诺是严格禁止的。
N诺非常重视学术诚信。此类行为将会导致您成为作弊者。具体细则请查看N诺社区规则。
孙某人
2024年3月8日 17:30
喝饮料 求助大佬,只有60%通过率
P1478
回复 2
|
赞 2
|
浏览 866
#include <iostream> #include <string.h> #include <math.h> #include<algorithm> using namespace std; int main(){ int cc=0,flag=0; double money,n,sum=0,sum1=0; double a[1005],b[1005],c[1005],d[1005]; while(cin >> money >>n){ if(money==-1&&a...
我要上岸!
2024年3月7日 16:20
喝饮料 题解:
P1478
回复 0
|
赞 1
|
浏览 1.0k
贪心问题,排好序就行 #include<bits/stdc++.h> #include<stdio.h> using namespace std; typedef struct node { int m; //量 int w; //钱 double value; //单价 }node; bool cmp(node a...
1935569240
2024年3月6日 13:40
喝饮料 题解:简单的
P1478
回复 0
|
赞 0
|
浏览 646
#include<iostream> #include<algorithm> #include<string> using namespace std; struct drink { int nums; double price; double singlePrice; }; bool cmp(struct drink a, struct drink b) { return ...
orderrr
2024年3月1日 15:10
喝饮料 题解:c语言实现。贪心算法,一开始就将最实惠的那类酒降序排列
P1478
回复 0
|
赞 0
|
浏览 795
#include <stdio.h> typedef struct { double mi, wi; } node; void sort(node node[], int n) { // 冒泡? for (int i = 0; i < n; i++) { int max = i; for (int j = i + 1; j < n; j++) { if (node[j].mi / node[j].wi > node[m...
小李122333
2024年1月11日 21:37
喝饮料 题解:c++版 sort函数 结构体数组
P1478
回复 0
|
赞 2
|
浏览 1.1k
#include <bits/stdc++.h> using namespace std; struct node{ double m,w; }arr[1002];//不超1000,故定义刚超过1000的大小 int cmp(node a,node b){ return a.m/a.w > b.m/b.w; } int main(){ int x,n; while(cin>>x>>n){ if(x==-1&&n==-1) break; f...
Syou
2023年8月18日 12:36
喝饮料 题解:
P1478
回复 0
|
赞 1
|
浏览 1.2k
C++ 非常经典的贪心算法题 #include <iostream> #include <vector> #include <algorithm> #include <iomanip> using namespace std; struct water{ double m; // 毫升 double w; // 价格 }; bool cmp(water a, water b){ return a.w / a.m < b.w / b.m; } int main(){ in...
928上岸梦校!
2023年7月5日 20:13
#贪心 #sort
P1478
回复 0
|
赞 3
|
浏览 1.6k
#include <bits/stdc++.h> using namespace std; typedef struct { double w, m; } water; bool cmp(water a, water b) { return a.m / a.w > b.m / b.w; } int main() { int n, x; while (cin >> x >> n) { if (x == -1 && n == -1...
阔赛英
2023年2月4日 13:15
贪心
P1478
回复 0
|
赞 1
|
浏览 4.0k
#include <iostream> #include <algorithm> using namespace std; struct Drink { double mi, wi;//毫升,价格 } dri[1024]; bool cmp(Drink a, Drink b) { return (a.wi / a.mi) < (b.wi / b.mi);//按照每毫升价格从小到大排序 } int main() { double x; int n; while (cin >...
dengfenglai
2021年3月13日 23:05
Python 80%,找不到原因懂得大佬下面评价一下
P1478
回复 0
|
赞 0
|
浏览 7.2k
while True: try: x, n = map(int, input().split()) dict = {} dict2 = {} if x == -1 and n == -1: pass else: for j in range(n): mi, wi = map(int, input().split()) danjia = wi / mi ...
seottle
2020年2月26日 16:36
通过率60%?求大佬解释哪里出错
P1478
回复 5
|
赞 3
|
浏览 13.2k
#include<bits/stdc++.h> using namespace std; struct beverage{ double mi; double price; double xjb; }be[1010]; bool cmp(beverage a, beve...
1
2
3
题目
喝饮料
题解数量
30
发布题解
在线答疑
热门题解
1
喝饮料 题解:
2
喝饮料 题解:正确率只有60%,请大佬帮忙康康哪里错了哇
3
喝饮料 题有没有佬给看看通过率为什么只有40
4
喝饮料 题解:每毫升的单价低者先喝
5
喝饮料 题解:记得第二次循环后清除数据
6
喝饮料 题解:就直接做呗
7
喝饮料 题解:额原来都只有一瓶啊
8
喝饮料 题解:
9
喝饮料 题解:(60%)
10
只有你够有钱,是可以全喝完的!