Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <bits/stdc++.h>
- using namespace std;
- struct tcoffee{
- string name;
- int ps,pm,pl;
- };
- struct ped{
- string name;
- string coname;
- string size;
- int uwu;
- };
- int check(int x){
- if(x%5==4) return x+1;
- else if(x%5==1) return x-1;
- }
- int main(){
- int t, c, p;
- cin>>t;
- while(t>0){
- cin>>c>>p;
- vector<tcoffee> tcoffees;
- vector<ped> pedidos;
- tcoffee type;
- ped pedi;
- string na;
- int pss,pmm,pll;
- for(int i=0;i<c;++i){
- cin>>na>>pss>>pmm>>pll;
- type.name = na;
- type.ps= pss;
- type.pm= pmm;
- type.pl= pll;
- tcoffees.push_back(type);
- }
- string coname;
- string sze;
- for(int i=0;i<p;++i){
- cin>>na>>sze>>coname;
- pedi.name= na;
- pedi.size= sze;
- pedi.coname=coname;
- pedi.uwu= 0;
- pedidos.push_back(pedi);
- }
- int price;
- int cotypri;
- for(int i=0;i<p;++i){
- for(int j=0;j<c;++j){
- if(tcoffees[j].name ==pedidos[i].coname ){
- if(pedidos[i].size== "small") cotypri= tcoffees[j].ps;
- if(pedidos[i].size== "medium") cotypri= tcoffees[j].pm;
- if(pedidos[i].size== "large") cotypri= tcoffees[j].pl;
- }
- }
- //cout<<cotypri<<endl;
- price=(100/p)+cotypri;
- if(price%5==4) price+=1;
- else if(price%5==1) price-=1;
- pedidos[i].uwu= price;
- // cout<<"uwu"<<endl;
- }
- for(int i = 0; i<p;++i){
- cout<<pedidos[i].name<<" "<<pedidos[i].uwu<<endl;
- }
- t--;
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement