随笔分类 -  4.4贪心

摘要:有种哈夫曼二叉树的思想。 #include<iostream> #include<algorithm> using namespace std; int a[10010] ={0}; int main(){ int n; cin>>n; for(int i = 0 ;i < n;++i) scanf 阅读全文
posted @ 2020-02-24 09:56 tangq123 阅读(120) 评论(0) 推荐(0)
摘要:水题。//输入为2 0 0 0 0 0 0 0 0 0会输出 00,但是还是对的。奇怪 #include<iostream> using namespace std; int a[10] = {0}; int main() { int flag = 0; for(int i = 0; i < 10; 阅读全文
posted @ 2020-02-16 16:49 tangq123 阅读(94) 评论(0) 推荐(0)
摘要:简单贪心算法。 把月饼按单价递减的顺序排列。 需求一定时,每次售出单价最高的月饼存量. #include"iostream" #include<algorithm> using namespace std; struct Moocake { double store,sale,price; } m[ 阅读全文
posted @ 2020-02-16 12:53 tangq123 阅读(131) 评论(0) 推荐(0)