当前位置: 代码迷 >> C语言 >> 我们昨天的acm题 分享一下
  详细解决方案

我们昨天的acm题 分享一下

热度:333   发布时间:2007-10-29 14:19:37.0
我们昨天的acm题 分享一下

Local area network

Time Limit:1000MS Memory Limit:65536K
Total Submit:0 Accepted:0

Description

A local area network (LAN) supplies networking capability to a group of computers in close proximity to each other such as in an office building, a school, or a home. A LAN is useful for sharing resources like files, printers, games or other applications. A LAN in turn often connects to other LANs, and to the Internet or other WAN.
In this contest, everybody is connecting with each others like the following figure.


The contest’s network was built as N rows and M columns, your computer locate at (0, 0) and the judger’s computer locate at (m-1, n-1) The code you submit would only transfer to up or right smoothly. It doesn’t matter if some accidents happened. Could you tell me how many ways from your computer to judger when a data wire was broken?

Input

There are multiple cases. Every case contains two integers in the first line, N, M (3<=N+M<=40). Second line contains four integers X1, Y1, X2, Y2 (0<=X1, X2<M, 0<=Y1, Y2<N, |X1+Y1-X2-Y2|=1), meaning the broken wire position.

Output

Print the answer in one line.

Sample Input


3 3
0 0 1 0


Sample Output


3

搜索更多相关的解决方案: acm  分享  

----------------解决方案--------------------------------------------------------
你怎么老是发这样的题目
什么都要自己想一下吧
像你这样做ACM题目,你说有多大的进步呢?
----------------解决方案--------------------------------------------------------
我不赞同您说的 不见识一下别人
怎么看的到自己 希望您以及各位大哥大姐多指教
我会一直以你们为榜样

----------------解决方案--------------------------------------------------------
能不能翻译下......
----------------解决方案--------------------------------------------------------

我的在oj上通过了的
#include <iostream>
using namespace std;
int a[100][100];
int qiuhe(int m,int n)
{ int i,j;
long int sum=0;
if(m==0&&n==0)
sum=1;
else
{
for(i=0;i<=m;i++)
a[i][0]=1;
for(j=0;j<=n;j++)
a[0][j]=1;
for(i=0;i<m-1;i++)
for(j=0;j<n-1;j++)
a[i+1][j+1]=a[i][j+1]+a[i+1][j];
sum=a[m-1][n-1];
}
return sum;
}
int main()
{
int x1,y1,x2,y2,m,n,temp;
while(cin>>m>>n)
{
long int answer=0;
cin>>x1>>y1>>x2>>y2;
if(x1+y1>x2+y2)
{
temp=x1;x1=x2;x2=temp;
temp=y1;y1=y2;y2=temp;
}
answer=qiuhe(m,n)-qiuhe(y1+1,x1+1)*qiuhe(m-y2,n-x2);
cout<<answer<<endl;
}
}


----------------解决方案--------------------------------------------------------

我的意见是``LS以后发ACM题```随便给个汉化版本的```这里的人大多数都不看懂鸟语吧```

[此贴子已经被作者于2007-10-30 21:05:52编辑过]


----------------解决方案--------------------------------------------------------
不看懂鸟语 又怎么消灭小鸟呢?????
----------------解决方案--------------------------------------------------------
回复:(心剑菩提)不看懂鸟语 又怎么消灭小鸟呢???...
暂时不要消灭小鸟嘛....
----------------解决方案--------------------------------------------------------

有点看不懂小鸟语言


----------------解决方案--------------------------------------------------------
这个题的意思是
以3*3为例

----------------解决方案--------------------------------------------------------
  相关解决方案