usaco-camp

Short, concise solutions for problems from the USACO camp

  1. 1
  2. 2
  3. 3
  4. 4
  5. 5
  6. 6
  7. 7
  8. 8
  9. 9
  10. 10
  11. 11
  12. 12
  13. 13
  14. 14
  15. 15
  16. 16
  17. 17
  18. 18
  19. 19
  20. 20
  21. 21
  22. 22
  23. 23
  24. 24
  25. 25
  26. 26
  27. 27
  28. 28
  29. 29
#include <bits/stdc++.h>
#define f first
#define s second
using namespace std;
typedef long long ll;
typedef pair<int, int> ii;

int main() {
	ios_base::sync_with_stdio(0), cin.tie(0);

	int n, a, b;
	string r;
	cin >> n >> a >> b >> r;
	
	if (r == "1/2") {
		for (int i = 0; i < n / 2; ++i) cout << b * i << ' ' << 0 << '\n';
		for (int i = n / 2; i < n; ++i) cout << b * i + a << ' ' << 0 << '\n';
	}
	else {
		int d = a * (b + 1) / 2 % b;
		for (int i = 0; i < n; ++i) {
			int x = d + (i / 4) * b, y = 0;
			if (i % 2 == 1) swap(x, y);
			if (i % 4 == 2) x = -x;
			if (i % 4 == 3) y = -y;
			cout << x + 500000000 << ' ' << y + 500000000 << '\n';
		}
	}
}