Advertisement
Guest User

Untitled

a guest
Apr 21st, 2019
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.40 KB | None | 0 0
  1. #include <iostream>
  2.  
  3. using namespace std;
  4. int szesnacie = 0;
  5. void srednia_odleglosc(int d, int l, int k, int h)
  6. {
  7. int tysiace = d * 1000;
  8. int setki = l * 100;
  9. int dziesiatki = k * 10;
  10. int jednosci = h;
  11. int suma = tysiace + setki + dziesiatki + jednosci;
  12.  
  13.  
  14. if (k==0 && h==1)
  15. {
  16. if (l % 3 == 2) {
  17.  
  18. cout << (l / 3) * 2 + 1;
  19.  
  20. }
  21. else cout << (l / 3) * 2;
  22. }
  23. else if (k==1 & h==1)
  24. {
  25. int k = l;
  26. l=l + 2*(l / 12);
  27. if (k % 12 > 6) ++l;
  28. if (k % 12 == 11)++l;
  29. cout << (l / 2);
  30.  
  31. }
  32. else if (k==2 & h==1)
  33. {
  34. if (l == 1) cout << "1";
  35. else cout << l/2;
  36. }
  37. else if (k == 2 && h == 0) cout << l / 3;
  38. else if (k == 1 && h == 0)
  39. {
  40. if (l % 5 == 3 || l % 5 == 4)
  41. {
  42. cout << (l / 5) * 2 + 1;
  43. }
  44. else if ((l / 5) * 2 == 16 ) cout << "17";
  45. else { cout << (l / 5) * 2; }
  46. }
  47. else if (k==0 && h==0)
  48. {
  49. l = l - (l - 2) / 15;
  50. cout << (l - 1) / 2;
  51. }
  52. }
  53.  
  54. int main()
  55. {
  56. int liczba_lini, d=1, l, k, h;
  57. cin >> liczba_lini;
  58. for (int i = 0; i < liczba_lini; i++)
  59. {
  60. cin >> d;
  61. cin >> l;
  62. cin >> k;
  63. cin >> h;
  64. int tysiace = d * 1000;
  65. int setki = l * 100;
  66. int dziesiatki = k * 10;
  67. int jednosci = h;
  68. int suma = tysiace + setki + dziesiatki + jednosci;
  69.  
  70. srednia_odleglosc(d, l, k, h);
  71.  
  72. //if (szesnacie<182)srednia_odleglosc(d, l, k, h);
  73. //else cout << suma;
  74. //
  75.  
  76. cout << endl;
  77. szesnacie++;
  78. }
  79. return 0;
  80. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement