随笔分类 - 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
阅读全文
摘要:水题。//输入为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;
阅读全文
摘要:简单贪心算法。 把月饼按单价递减的顺序排列。 需求一定时,每次售出单价最高的月饼存量. #include"iostream" #include<algorithm> using namespace std; struct Moocake { double store,sale,price; } m[
阅读全文

浙公网安备 33010602011771号