Online JudgeProblem SetAuthorsOnline ContestsUser
Web Board
Home Page
F.A.Qs
Statistical Charts
Problems
Submit Problem
Online Status
Prob.ID:
Register
Update your info
Authors ranklist
Current Contest
Past Contests
Scheduled Contests
Award Contest
User ID:
Password:
  Register

求易错数据

Posted by 120302508 at 2013-01-20 22:42:50 on Problem 1189
In Reply To:To WAers Posted by:Ruby931031 at 2012-04-02 12:04:03
#include<stdio.h>

int main()
{
	long long int a[101], r, r2;
	int n, m, i, j, s, e;
	char x;
	while (~scanf("%d %d", &n, &m))
	{
		for (i = 0; i <= 2 * n; i++)
			a[i] = 0;
		s = e = n;
		r2 = a[n] = (long long int)1 << n;
		for (j = 0; j < n; j++)
		{
			for (i = s; i <= e; i += 2)
			{
				getchar();
				x = getchar();
				if (x == '*')
				{
					a[i - 1] += a[i] / 2;
					a[i + 1] += a[i] / 2;
					a[i] = 0;
				}
			}
			s--;
			e++;
		}
		for (i = 1; i <= 2 * n; i += 2)
		{
			a[i - 1] += a[i] / 2;
			a[i + 1] += a[i] / 2;
			a[i] = 0;
		}
		r = a[2 * m];
		if (r)
		{
			while (!(r % 2))

			{
				r /= 2;
				r2 /= 2;
			}
			printf("%lld/%lld\n", r, r2);
		}
		else
			printf("0/1\n");
	}
	return 0;
}

Followed by:

Post your reply here:
User ID:
Password:
Title:

Content:

Home Page   Go Back  To top


All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator