文章

3

粉丝

5

获赞

2

访问

3.0k

头像
塑身菜单 题解:
P1054
发布于2023年10月21日 23:50
阅读数 1.1k

#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;
}
...
登录查看完整内容


登录后发布评论

暂无评论,来抢沙发