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

Re:这就是模拟吧。。。

Posted by Phtato at 2016-02-08 21:28:52 on Problem 1189
In Reply To:这就是模拟吧。。。 Posted by:lagoon0o0 at 2012-05-04 23:42:20
> #include <iostream>
> #include <cstdio>
> #include <cstdlib>
> #include <cstring>
> using namespace std;
> typedef long long lint;
> lint map[55][55];
> int n,m;
> char s[55][110];
> bool vis[55][55];
> int main()
> {
> 	
> 	scanf("%d%d\n",&n, &m);
> 	for(int i = 1; i <= n; i++)
> 	gets(s[i]);
> 	for(int i = 1; i <= n; i++)
> 		for(int j = 0,cnt = 0;s[i][j] != '\0'; j++)
> 			if(s[i][j] == '*' || s[i][j] == '.')
> 			{
> 				cnt++;
> 				if(s[i][j] == '.')
> 				vis[i][cnt] = true;
> 			}
> 	map[1][1] = (lint)1<<n;
> 	for(int i = 1; i <= n; i++)
> 		for(int j = 1; j <= i; j++)
> 		{
> 			if(vis[i][j])
> 			map[i+2][j+1] += map[i][j];
> 			else
> 			{
> 				map[i+1][j] += map[i][j]>>1;
> 				map[i+1][j+1] += map[i][j]>>1;
> 			}
> 		}
> 	if(map[n+1][m+1] == 0)
> 	printf("0/1\n");
> 	else
> 	{
> 		while(!(map[n+1][m+1]&1))
> 		map[1][1] >>= 1,map[n+1][m+1] >>= 1;
> 		printf("%lld/%lld",map[n+1][m+1],map[1][1]);
> 	}
> 	//system("pause");
> 	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