- 寻宝
- 2015-08-14 10:45:16 @
#include<cstdio>
#include<iostream>
#include<cmath>
#include<cstring>
using namespace std;
int main()
{
//freopen("xx.in","r",stdin);
//freopen("xx.out","w",stdout);
int x[10005][105],sum=0,n,m,z;
bool a[10005][105];
memset(a,0,sizeof(a));
memset(x,0,sizeof(x));
scanf("%d%d",&n,&m);
for(int i=1;i<=n;++i)
for(int j=0;j<m;++j)
scanf("%d%d",&a[i][j],&x[i][j]);
scanf("%d",&z);
for (int i=1;i<=n;++i)
{
sum+=x[i][z];
for(int j=0;j<=x[i][z];z--)
{ if(z==-1)z=m-1;
if(a[i][z]==1)j++;
}
}
printf("%d",sum);
}
2 条评论
-
he840408904 LV 4 @ 2015-08-14 14:27:10
可以去看看题解
-
2015-08-14 14:25:45@
水死了!
- 1