Advertisement
Guest User

Untitled

a guest
Jan 17th, 2020
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.38 KB | None | 0 0
  1. #include <bits/stdc++.h>
  2. using namespace std;
  3. struct tcoffee{
  4. string name;
  5. int ps,pm,pl;
  6. };
  7. struct ped{
  8. string name;
  9. string coname;
  10. string size;
  11. int uwu;
  12. };
  13. int check(int x){
  14. if(x%5==4) return x+1;
  15. else if(x%5==1) return x-1;
  16. }
  17. int main(){
  18. int t, c, p;
  19. cin>>t;
  20. while(t>0){
  21. cin>>c>>p;
  22. vector<tcoffee> tcoffees;
  23. vector<ped> pedidos;
  24. tcoffee type;
  25. ped pedi;
  26. string na;
  27. int pss,pmm,pll;
  28. for(int i=0;i<c;++i){
  29. cin>>na>>pss>>pmm>>pll;
  30. type.name = na;
  31. type.ps= pss;
  32. type.pm= pmm;
  33. type.pl= pll;
  34. tcoffees.push_back(type);
  35. }
  36. string coname;
  37. string sze;
  38. for(int i=0;i<p;++i){
  39. cin>>na>>sze>>coname;
  40. pedi.name= na;
  41. pedi.size= sze;
  42. pedi.coname=coname;
  43. pedi.uwu= 0;
  44. pedidos.push_back(pedi);
  45. }
  46. int price;
  47. int cotypri;
  48. for(int i=0;i<p;++i){
  49. for(int j=0;j<c;++j){
  50. if(tcoffees[j].name ==pedidos[i].coname ){
  51. if(pedidos[i].size== "small") cotypri= tcoffees[j].ps;
  52. if(pedidos[i].size== "medium") cotypri= tcoffees[j].pm;
  53. if(pedidos[i].size== "large") cotypri= tcoffees[j].pl;
  54. }
  55. }
  56. //cout<<cotypri<<endl;
  57. price=(100/p)+cotypri;
  58. if(price%5==4) price+=1;
  59. else if(price%5==1) price-=1;
  60. pedidos[i].uwu= price;
  61. // cout<<"uwu"<<endl;
  62. }
  63. for(int i = 0; i<p;++i){
  64. cout<<pedidos[i].name<<" "<<pedidos[i].uwu<<endl;
  65. }
  66. t--;
  67. }
  68. return 0;
  69. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement