| 比赛 |
20251019新安模拟赛1 |
评测结果 |
AAAAAAAAAA |
| 题目名称 |
密码锁 |
最终得分 |
100 |
| 用户昵称 |
tomato的 |
运行时间 |
0.031 s |
| 代码语言 |
C++ |
内存使用 |
3.89 MiB |
| 提交时间 |
2025-10-19 09:43:34 |
显示代码纯文本
#include<bits/stdc++.h>
using namespace std;
int f[10][10][10][10][10];
int main(){
freopen("lock.in", "r", stdin);
freopen("lock.out", "w", stdout);
int n;
cin >> n;
for(int i = 0; i < n; i++){
int a, b, c, d, e;
cin >> a >> b >> c >> d >> e;
for(int j = 1; j <= 9; j++){
f[(a + j) % 10][b][c][d][e]++;
f[a][(b + j) % 10][c][d][e]++;
f[a][b][(c + j) % 10][d][e]++;
f[a][b][c][(d + j) % 10][e]++;
f[a][b][c][d][(e + j) % 10]++;
f[(a + j) % 10][(b + j) % 10][c][d][e]++;
f[a][(b + j) % 10][(c + j) % 10][d][e]++;
f[a][b][(c + j) % 10][(d + j) % 10][e]++;
f[a][b][c][(d + j) % 10][(e + j) % 10]++;
}
}
int ans = 0;
for(int i = 0; i <= 9; i++)
for(int j = 0; j <= 9; j++)
for(int k = 0; k <= 9; k++)
for(int q = 0; q <= 9; q++)
for(int w = 0; w <= 9; w++)
if(f[i][j][k][q][w] == n) ans++;
cout << ans;
return 0;
}