Advertisement
Guest User

Untitled

a guest
Feb 21st, 2019
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.68 KB | None | 0 0
  1. #include <iostream>
  2.  
  3. using namespace std;
  4. struct darp
  5. {
  6. char in;//inicjał sprzedawcy
  7. float kasa; //$$
  8. };
  9.  
  10. int main() {
  11.  
  12. darp wy[90][190];
  13. int a=0,i;
  14. double duza_kasa;
  15. cin>>a;
  16. for (int l=0;l<a;l++){
  17. i=0;
  18. while(cin>>wy[l][i].kasa && wy[l][i].kasa!=0 || i==0){
  19. i++;
  20. }
  21. for(int k=0;k<i;k++){
  22. cin>>wy[l][k].in;
  23. }
  24. }
  25.  
  26.  
  27. for (int l=0;l<a;l++){
  28. duza_kasa=0;
  29. for (int j=0;j<190&&wy[l][j].kasa!=0;j++){
  30. if (wy[l][j].kasa + wy[l][j-1].kasa + wy[l][j-2].kasa>duza_kasa){
  31. duza_kasa= wy[l][j].kasa + wy[l][j-1].kasa + wy[l][j-2].kasa;
  32. i=j;
  33. }}
  34. cout<<wy[l][i-2].in<<" "<<wy[l][i-1].in<<" "<<wy[l][i].in<<endl;
  35. }
  36.  
  37. return 0;
  38. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement