zoukankan      html  css  js  c++  java
  • 塑身菜单

    从现在开始,拟定属于你自己的健康饮食方案吧! 一份全新的健康饮食计划,将会使
    你浑身充满活力。如果长时间坚持这样的饮食,那么不仅你患疾病的几率降低,而且还会比
    预期寿命延长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;
     }
  • 相关阅读:
    初识CSS
    网页特殊符号HTML代码大全
    HTML基础
    python :ascii codec can't decode byte 0xe8 in posit
    linux shell中单引号、双引号和没有引号的区别
    初识HTML
    Python操作 Memcache、Redis、RabbitMQ
    使用fastdfs-zyc监控FastDFS文件系统
    Python---初识堡垒机
    SQL Server ->> Online Index Rebuilding(联机索引重建)
  • 原文地址:https://www.cnblogs.com/Lazy-Cat/p/9838035.html
Copyright © 2011-2022 走看看