UOJ Logo

NOI.AC

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#186481#3351. 霜冻碎片Harry2718210014ms1416kbC++11569b2023-10-01 08:59:292023-10-01 12:32:26

answer

#include<bits/stdc++.h>
using namespace std;
int n,m,a[205][205],tot1,tot2,x[205],y[205],ans;
int main()
{
    cin.tie(0)->sync_with_stdio(0);
	cin>>n>>m;
	for(int i=1;i<=n;i++)
	{
		for(int j=1;j<=m;j++)cin>>a[i][j]; 
	}
	if(n%3==0)
	{
		for(int i=2;i<=n;i+=3)x[++tot1]=i;
	}
	else 
	{
		for(int i=1;i<=n;i+=3)x[++tot1]=i;
	}
	if(m%3==0)
	{
		for(int i=2;i<=m;i+=3)y[++tot2]=i;
	}
	else 
	{
		for(int i=1;i<=m;i+=3)y[++tot2]=i;
	}
	for(int i=1;i<=tot1;i++)
	{
		for(int j=1;j<=tot2;j++)ans+=a[x[i]][y[j]];
	}
	cout<<ans;
	return 0;
}

Details

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

Test #1:

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

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: 1ms
memory: 1256kb

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: 1256kb

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: 1412kb

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: 4ms
memory: 1412kb

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: 2ms
memory: 1404kb

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: 1ms
memory: 1416kb

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: 2ms
memory: 1416kb

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: 2ms
memory: 1408kb

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: 2ms
memory: 1416kb

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"