• 塑身菜单


    从现在开始,拟定属于你自己的健康饮食方案吧! 一份全新的健康饮食计划,将会使
    你浑身充满活力。如果长时间坚持这样的饮食,那么不仅你患疾病的几率降低,而且还会比
    预期寿命延长15 年。当然,随之而来的,还有你一直向往的好身材。假设供选择的菜单如
    下:每份热量单位:大卡/100 克

    假设供选择的菜单如下:每份热量单位:大卡/100 克
    Boiled Fish with Pickled Cabbage and Chili 92
    Sauted Sliced Pork with Pepper and Chili , Sichuan Style 231
    Cold Noodles Sichuan Style 260
    Fish Filets in Hot Chili Oil 239
    Steamed Rice Rolls 196
    Kung Pao Chicken 313
    Hot and Sour Rice Noodles 144

    Soybean Milk 92
    Steamed Rice 31
    Scrambled Egg with Scallion 81
    Steamed Jiaozi 119
    Sauted Sliced Pork with Black Fungus 143

    Scrambled Egg with Leek 128
    Steamed Bun Stuffed with Red Bean Paste 128
    Yu-Shiang Shredded Pork (Sauted with Spicy Garlic Sauce) 134

    输入

    输入最大摄入热量值(要求:每份菜只能要一份)

    输出

    输出满足总摄入热量小于等于最大摄入热量值的菜品种类最多的组合

    样例输入

    150

    样例输出

    Steamed Rice 31
    Scrambled Egg with Scallion 81
    #include <iostream>
     using namespace std;
     int main()
     {
      int i,s=0,k;
      struct menu
      {
      char name[100];
       int hot;
      }a[15]={ 
          {"Steamed Rice",31}, 
          {"Scrambled Egg with Scallion",81}, 
          {"Boiled Fish with Pickled Cabbage and Chili",92}, 
          {"Soybean Milk",92}, 
          {"Steamed Jiaozi",119}, 
          {"Scrambled Egg with Leek",128}, 
          {"Steamed Bun Stuffed with Red Bean Paste",128}, 
          {"Yu-Shiang Shredded Pork (Sauted with Spicy Garlic Sauce)",134}, 
          {"Sauted Sliced Pork with Black Fungus",143}, 
          {"Hot and Sour Rice Noodles",144}, 
          {"Steamed Rice Rolls",196}, 
          {"Sauted Sliced Pork with Pepper and Chili , Sichuan Style",231}, 
          {"Fish Filets in Hot Chili Oil",239}, 
          {"Cold Noodles Sichuan Style",260}, 
          {"Kung Pao Chicken",313}, 
      };
      cin>>k;
      for(i=0;i<15;i++)
      {
       s+=a[i].hot;
       if(s<=k)cout<<a[i].name<<" "<<a[i].hot<<endl;
       else break;
      }
      return 0;
     }
  • 相关阅读:
    shell编程系列5--数学运算
    qperf测量网络带宽和延迟
    使用gprof对应用程序做性能评测
    [转]极不和谐的 fork 多线程程序
    Emacs显示光标在哪个函数
    Iterm2的一些好用法
    [转]最佳日志实践
    Deep Introduction to Go Interfaces.
    CGo中传递多维数组给C函数
    seaweedfs 源码笔记(一)
  • 原文地址:https://www.cnblogs.com/Lazy-Cat/p/9838035.html
Copyright © 2020-2023  润新知