ProgramAlgTrain/20240829/B4015/B4015.cpp
2024-08-30 17:13:52 +08:00

33 lines
586 B
C++

#include <cctype>
#include <cstdio>
#include <iostream>
using namespace std;
typedef long long ll;
ll readint(){
int x=0,w=1;
char ch=0;
while(!isdigit(ch)){
if(ch=='-')w=-1;
ch=getchar();
}
while(isdigit(ch)){
x=x*10+(ch-'0');
ch=getchar();
}
return x*w;
}
int main(){
const ll n=readint(),m=readint();
ll ans{};
for(int i=1;i<=n;i++){
for(int j=1;j<=m;j++){
ll num{readint()};
if(i%3==2&&j%3==2){
ans+=num;
}
}
}
printf("%lld",ans);
}