UOJ Logo

NOI.AC

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#186563#3351. 霜冻碎片quliannanyishou1001ms1332kbC++11610b2023-10-01 09:46:442023-10-01 12:35:26

answer

#include<bits/stdc++.h>
using namespace std;
int m,n,a[210][210],ans=0,sx,sy;
inline int read()
{
    int x=0,f=1;
    char ch=getchar();
    while(ch<'0'||ch>'9')
    {
        if(ch=='-')
            f=-1;
        ch=getchar();
    }
    while(ch>='0' && ch<='9')
        x=x*10+ch-'0',ch=getchar();
    return x*f;
}
int main()
{
	m=read();
	n=read();
	for(int i=1;i<=m;++i)
	{
		for(int j=1;j<=n;++j)
		{
			a[i][j]=read();
		}
	}
	sy=m%3==0?2:1;
	sx=n%3==0?2:1;
	for(int i=sy;i<=m;i+=3)
	{
		for(int j=sx;j<=n;j+=3)
		{
			ans+=a[i][j];
		}
	}
	cout<<ans<<endl;    
}

Details

小提示:点击横条可展开更详细的信息

Test #1:

score: 10
Accepted
time: 0ms
memory: 1164kb

input:

2 10
4 5 4 4 4 4 2 2 1 1
4 5 4 4 4 4 2 2 1 1

output:

11

result:

ok 1 number(s): "11"

Test #2:

score: 10
Accepted
time: 0ms
memory: 1164kb

input:

3 6
2 2 2 3 3 1
3 4 3 5 5 3
2 3 2 4 4 3

output:

9

result:

ok 1 number(s): "9"

Test #3:

score: 10
Accepted
time: 0ms
memory: 1164kb

input:

4 5
3 4 4 4 3
4 6 5 5 3
5 7 6 6 4
3 5 4 4 2

output:

14

result:

ok 1 number(s): "14"

Test #4:

score: 10
Accepted
time: 0ms
memory: 1320kb

input:

191 182
2 2 3 2 2 1 1 1 1 0 2 2 3 1 1 1 3 5 4 3 2 3 2 1 1 2 3 4 3 2 2 3 4 3 2 2 2 4 4 5 5 6 5 3 2 2 ...

output:

17471

result:

ok 1 number(s): "17471"

Test #5:

score: 10
Accepted
time: 0ms
memory: 1324kb

input:

189 187
3 5 5 5 4 4 4 5 5 3 2 2 3 2 1 1 2 4 4 3 2 2 4 4 4 2 3 2 4 3 4 4 4 3 3 4 6 5 5 5 4 4 4 5 5 5 ...

output:

17802

result:

ok 1 number(s): "17802"

Test #6:

score: 10
Accepted
time: 0ms
memory: 1316kb

input:

181 187
1 2 4 4 3 3 4 5 4 3 3 3 4 5 4 2 1 1 2 2 4 4 4 2 2 2 4 4 4 4 4 5 3 2 0 2 3 3 2 1 2 2 2 2 1 3 ...

output:

16786

result:

ok 1 number(s): "16786"

Test #7:

score: 10
Accepted
time: 0ms
memory: 1332kb

input:

200 197
4 5 3 2 2 3 3 3 4 4 4 3 4 5 5 4 3 3 2 2 2 3 3 4 5 5 3 2 2 3 2 2 2 2 2 1 3 2 3 2 3 3 3 2 1 1 ...

output:

19623

result:

ok 1 number(s): "19623"

Test #8:

score: 10
Accepted
time: 0ms
memory: 1324kb

input:

196 184
2 2 2 3 4 4 3 4 4 3 2 2 3 2 1 2 4 4 4 3 4 3 2 1 1 3 4 3 2 3 5 6 5 4 3 3 4 3 3 2 4 4 4 2 2 2 ...

output:

18159

result:

ok 1 number(s): "18159"

Test #9:

score: 10
Accepted
time: 0ms
memory: 1316kb

input:

185 192
4 5 4 2 2 1 3 3 3 2 1 1 1 1 2 3 5 6 6 5 5 5 6 4 2 2 3 5 5 6 5 4 3 3 3 3 3 3 4 3 3 1 2 3 5 4 ...

output:

17796

result:

ok 1 number(s): "17796"

Test #10:

score: 10
Accepted
time: 1ms
memory: 1320kb

input:

192 185
3 3 2 2 4 4 4 3 2 2 2 3 4 3 3 1 1 0 2 3 5 5 4 3 2 4 4 4 3 3 3 4 4 3 2 2 4 4 5 3 3 2 2 2 1 3 ...

output:

17644

result:

ok 1 number(s): "17644"