Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- int szesnacie = 0;
- void srednia_odleglosc(int d, int l, int k, int h)
- {
- int tysiace = d * 1000;
- int setki = l * 100;
- int dziesiatki = k * 10;
- int jednosci = h;
- int suma = tysiace + setki + dziesiatki + jednosci;
- if (k==0 && h==1)
- {
- if (l % 3 == 2) {
- cout << (l / 3) * 2 + 1;
- }
- else cout << (l / 3) * 2;
- }
- else if (k==1 & h==1)
- {
- int k = l;
- l=l + 2*(l / 12);
- if (k % 12 > 6) ++l;
- if (k % 12 == 11)++l;
- cout << (l / 2);
- }
- else if (k==2 & h==1)
- {
- if (l == 1) cout << "1";
- else cout << l/2;
- }
- else if (k == 2 && h == 0) cout << l / 3;
- else if (k == 1 && h == 0)
- {
- if (l % 5 == 3 || l % 5 == 4)
- {
- cout << (l / 5) * 2 + 1;
- }
- else if ((l / 5) * 2 == 16 ) cout << "17";
- else { cout << (l / 5) * 2; }
- }
- else if (k==0 && h==0)
- {
- l = l - (l - 2) / 15;
- cout << (l - 1) / 2;
- }
- }
- int main()
- {
- int liczba_lini, d=1, l, k, h;
- cin >> liczba_lini;
- for (int i = 0; i < liczba_lini; i++)
- {
- cin >> d;
- cin >> l;
- cin >> k;
- cin >> h;
- int tysiace = d * 1000;
- int setki = l * 100;
- int dziesiatki = k * 10;
- int jednosci = h;
- int suma = tysiace + setki + dziesiatki + jednosci;
- srednia_odleglosc(d, l, k, h);
- //if (szesnacie<182)srednia_odleglosc(d, l, k, h);
- //else cout << suma;
- //
- cout << endl;
- szesnacie++;
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement