版本比较
此地无雷 301 个(QZOI 菜单生成器 2.0)
正文
增加 28 行删除 28 行
48 行未改动495051525354555657585960616263646566676869707172732 行未改动767778798081828384858687888990919293949596976 行未改动10410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713811 行未改动1501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821833 行未改动18718818919019119219319419519616 行未改动21321421521621721821922022127 行未改动48 行未改动#define INF 1145141919810using namespace std;/*技术指导:SetConsoleOutputCP(65001); 设置 UTF-8【正确】cin.clear(); 在多个 freopen 之间炸东西【正确】同 cout.clear();【需要验证】预设方案:通过 QZ_cds(1or2or3).txt 进行读入每一行:第一个为编号第二个为菜品名称第三个为价格QZ_cds1.txt 大荤QZ_cds2.txt 小荤QZ_cds3.txt 素菜QZ_cds4.txt 汤标配:2大 1小 2素 1汤*/int ccd[301][301];int year,month,day,wky;int cnt1,cnt2,cnt3,cnt4;2 行未改动int vel31,vel32;int vel41;int vel5;string vel5s[1201];//水果/酸奶,水果前 12 种,酸奶等后 4 种(13,14,15,16)int vel51[1201]={0,1,2,3,4,5};int vel52[1201]={0,1,2,3,4,6,7,8};int vel53[1201]={0,1,2,3,4,8,9,10,11,12};int vel54[1201]={0,1,2,3,4,9,10,11,12};int cnt51=5,cnt52=7,cnt53=9,cnt54=8;string autol[1201];struct veal{// string bihl;//编号string micl;//名称double pril;//价格}vel1[1201],vel2[1201],vel3[1201],vel4[1201];void first_print();void get_date();//获取当前日期void get_vel(){//找出合适的菜编号 #11rvel11=rand()%cnt1+1;vel12=rand()%cnt1+1;while(vel12==vel11)vel12=rand()%cnt1+1;6 行未改动int pr2=vel2[vel21].pril;int pr3=vel3[vel31].pril+vel3[vel32].pril;//初步计算价格if(pr1+pr2+pr3<=11)return;if(pr1>6){//大荤安排 6 元if(vel1[vel11].pril<vel1[vel12].pril)swap(vel11,vel12);//从大的开刀while(vel1[vel11].pril+vel1[vel12].pril>6)vel11=rand()%cnt1+1;//重新选择pr1=vel1[vel11].pril+vel1[vel12].pril;if(pr1+pr2+pr3<=11)return;}if(pr2>2){//小荤安排 2 元while(vel2[vel21].pril>2)vel21=rand()%cnt2+1;//重新选择pr2=vel2[vel21].pril;if(pr1+pr2+pr3<=11)return;}if(pr3>3){//素菜安排 3 元if(vel3[vel31].pril<vel3[vel32].pril)swap(vel31,vel32);//从大的开刀while(vel3[vel31].pril+vel3[vel32].pril>3)vel31=rand()%cnt3+1;//重新选择pr3=vel3[vel31].pril+vel3[vel32].pril;if(pr1+pr2+pr3<=11)return;}}void get_sp(){//汤品,纯随机vel41=rand()%cnt4+1;}void get_frt(){//水果/酸奶,按照季节if(wky==1)vel5=13+rand()%2;else if(wky==3)vel5=16;else if(wky==5)vel5=15;else{11 行未改动// SetConsoleOutputCP(65001);SetConsoleCP(65001);srand(time(0));first_print();get_date();//获取当前日期freopen("QZ_cds1.txt","r",stdin);while(cin>>vel1[++cnt1].micl){cin>>vel1[cnt1].pril;//读入大荤菜品}cnt1--;cin.clear();freopen("QZ_cds2.txt","r",stdin);while(cin>>vel2[++cnt2].micl){cin>>vel2[cnt2].pril;//读入小荤菜品}cnt2--;cin.clear();freopen("QZ_cds3.txt","r",stdin);while(cin>>vel3[++cnt3].micl){cin>>vel3[cnt3].pril;//读入素菜}cnt3--;cin.clear();freopen("QZ_cds4.txt","r",stdin);while(cin>>vel4[++cnt4].micl){cin>>vel4[cnt4].pril;//读入汤品}cnt4--;cin.clear();freopen("QZ_fruits.txt","r",stdin);3 行未改动freopen("QZ_auto.txt","r",stdin);for(int i=1;i<=8;i++)cin>>autol[i];/*以上为输入部分以下为处理部分*/for(int dy=1;dy<=6;dy++){get_vel();get_sp();16 行未改动ccd[13][dy]=vel41;}/*以上为处理部分以下为输出部分*/freopen("QZ_cds.txt","w",stdout);cout<<"\xEF\xBB\xBF";//? UTF-8 发力了for(int i=1;i<=6;i++){27 行未改动48 行未改动495051525354555657585960616263646566676869707172732 行未改动767778798081828384858687888990919293949596976 行未改动10410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713811 行未改动1501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821833 行未改动18718818919019119219319419519616 行未改动21321421521621721821922022127 行未改动48 行未改动#define INF 1145141919810using namespace std;/*技术指导:SetConsoleOutputCP(65001); 设置 UTF-8【正确】cin.clear(); 在多个 freopen 之间炸东西【正确】同 cout.clear();【需要验证】预设方案:通过 QZ_cds(1or2or3).txt 进行读入每一行:第一个为编号第二个为菜品名称第三个为价格QZ_cds1.txt 大荤QZ_cds2.txt 小荤QZ_cds3.txt 素菜QZ_cds4.txt 汤标配:2大 1小 2素 1汤*/int ccd[301][301];int year,month,day,wky;int cnt1,cnt2,cnt3,cnt4;2 行未改动int vel31,vel32;int vel41;int vel5;string vel5s[1201];//水果/酸奶,水果前 12 种,酸奶等后 4 种(13,14,15,16)int vel51[1201]={0,1,2,3,4,5};int vel52[1201]={0,1,2,3,4,6,7,8};int vel53[1201]={0,1,2,3,4,8,9,10,11,12};int vel54[1201]={0,1,2,3,4,9,10,11,12};int cnt51=5,cnt52=7,cnt53=9,cnt54=8;string autol[1201];struct veal{// string bihl;//编号string micl;//名称double pril;//价格}vel1[1201],vel2[1201],vel3[1201],vel4[1201];void first_print();void get_date();//获取当前日期void get_vel(){//找出合适的菜编号 #11rvel11=rand()%cnt1+1;vel12=rand()%cnt1+1;while(vel12==vel11)vel12=rand()%cnt1+1;6 行未改动int pr2=vel2[vel21].pril;int pr3=vel3[vel31].pril+vel3[vel32].pril;//初步计算价格if(pr1+pr2+pr3<=11)return;if(pr1>6){//大荤安排 6 元if(vel1[vel11].pril<vel1[vel12].pril)swap(vel11,vel12);//从大的开刀while(vel1[vel11].pril+vel1[vel12].pril>6)vel11=rand()%cnt1+1;//重新选择pr1=vel1[vel11].pril+vel1[vel12].pril;if(pr1+pr2+pr3<=11)return;}if(pr2>2){//小荤安排 2 元while(vel2[vel21].pril>2)vel21=rand()%cnt2+1;//重新选择pr2=vel2[vel21].pril;if(pr1+pr2+pr3<=11)return;}if(pr3>3){//素菜安排 3 元if(vel3[vel31].pril<vel3[vel32].pril)swap(vel31,vel32);//从大的开刀while(vel3[vel31].pril+vel3[vel32].pril>3)vel31=rand()%cnt3+1;//重新选择pr3=vel3[vel31].pril+vel3[vel32].pril;if(pr1+pr2+pr3<=11)return;}}void get_sp(){//汤品,纯随机vel41=rand()%cnt4+1;}void get_frt(){//水果/酸奶,按照季节if(wky==1)vel5=13+rand()%2;else if(wky==3)vel5=16;else if(wky==5)vel5=15;else{11 行未改动// SetConsoleOutputCP(65001);SetConsoleCP(65001);srand(time(0));first_print();get_date();//获取当前日期freopen("QZ_cds1.txt","r",stdin);while(cin>>vel1[++cnt1].micl){cin>>vel1[cnt1].pril;//读入大荤菜品}cnt1--;cin.clear();freopen("QZ_cds2.txt","r",stdin);while(cin>>vel2[++cnt2].micl){cin>>vel2[cnt2].pril;//读入小荤菜品}cnt2--;cin.clear();freopen("QZ_cds3.txt","r",stdin);while(cin>>vel3[++cnt3].micl){cin>>vel3[cnt3].pril;//读入素菜}cnt3--;cin.clear();freopen("QZ_cds4.txt","r",stdin);while(cin>>vel4[++cnt4].micl){cin>>vel4[cnt4].pril;//读入汤品}cnt4--;cin.clear();freopen("QZ_fruits.txt","r",stdin);3 行未改动freopen("QZ_auto.txt","r",stdin);for(int i=1;i<=8;i++)cin>>autol[i];/*以上为输入部分以下为处理部分*/for(int dy=1;dy<=6;dy++){get_vel();get_sp();16 行未改动ccd[13][dy]=vel41;}/*以上为处理部分以下为输出部分*/freopen("QZ_cds.txt","w",stdout);cout<<"\xEF\xBB\xBF";//? UTF-8 发力了for(int i=1;i<=6;i++){27 行未改动