Menu

Timus 1615. Трамвайный пасьянс / Tram Solitaire

January 2, 2017 - ACM Timus

Language: C++

#include <cstdio>

using namespace std;

int N;

int GCD(int X, int Y)
{
	int R;
	while (Y > 0)
	{
		R = Y;
		Y = X % Y;
		X = R;
	}
	return X;
}

int main()
{
#ifndef ONLINE_JUDGE
	freopen("Ural1615.in", "r", stdin);
	freopen("Ural1615.out", "w", stdout);
#endif
	scanf("%d", &N);
	int A = (N + 1) * (N + 2) - 4;
	int B = (N + N - 1) * (N + N);
	int D = GCD(A, B);
	printf("%d/%d", A / D, B / D);
	return 0;
}

(91)

It's only fair to share...Share on FacebookShare on Google+Tweet about this on TwitterShare on LinkedInShare on VK

Author of this post : Unknown Author

Leave a Reply

Your email address will not be published. Required fields are marked *