#include <bits/stdc++.h>
using namespace std;
int n,a[6],qq[101][6],cnt,bj[101],ans;
int main(){
scanf("%d",&n);
for(int i=1;i<=n;i++){
for(int j=1;j<=5;j++){
scanf("%d",&a[j]);
}
if(i==1){
for(int j=1;j<=5;j++){
for(int k=1;k<=9;k++){
cnt++;
for(int l=1;l<=5;l++){
qq[cnt][l]=a[l];
}
qq[cnt][j]=(a[j]+k)%10;
}
}
for(int j=1;j<=4;j++){
for(int k=1;k<=9;k++){
cnt++;
for(int l=1;l<=5;l++){
qq[cnt][l]=a[l];
}
qq[cnt][j]=(a[j]+k)%10;
qq[cnt][j+1]=(a[j+1]+k)%10;
}
}
}else{
for(int j=1;j<=cnt;j++){
if(!bj[j]){
int cj,cs=0,xl=0;
for(int k=1;k<=5;k++){
if(qq[j][k]!=a[k]){
cs++;
cj=(qq[j][k]-a[k]+10)%10;
if(qq[j][k+1]!=a[k+1]){
xl=1;
if((qq[j][k+1]-a[k+1]+10)%10!=cj){
bj[j]=1;
break;
}
}
}
}
if(cs>2||cs==0||(cs==2&&xl==0)){
bj[j]=1;
}
}
}
}
}
for(int i=1;i<=cnt;i++){
if(!bj[i]){
ans++;
}
}
printf("%d",ans);
return 0;
}
和AC做法类似,有个神奇样例六:
输入:
4
8 6 9 9 4
8 6 8 9 4
8 6 7 9 4
8 6 1 9 4
输出:
6
我的:
4
8 6 9 9 4
8 6 8 9 4
8 6 7 9 4
8 6 1 9 4
6
--------------------------------
Process exited after 2.534 seconds with return value 0
请按任意键继续. . .
评测机:
样例六:Wrong Answer.wrong answer On line 1 column 1, read 7, expected 6.
太诡异了,求大佬解惑