Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <bits/stdc++.h>
- using namespace std;
- #define D(x) cout << #x << " = " << (x) << endl
- #define fr freopen("in.txt", "r", stdin);
- #define fw freopen("out.txt", "w", stdout);
- #define mem(x) memset((x), 0, sizeof((x)));
- int main(){
- int tc;
- cin >> tc;
- for(int tr = 1; tr <= tc; tr++){
- int n, m;
- cin >> n;
- m = n;
- int ara[n][m];
- for(int i = 0; i < n; i++){
- for(int j = 0; j < m; j++){
- cin >> ara[i][j];
- }
- }
- int ans = 0;
- for(int start = 0; start < n; start++){
- for(int edn = 0; edn < m; edn++){
- for(int i = start; i < n; i++){
- for(int j = edn; j < m; j++){
- // D(ara[i][j]);
- int marker[11];
- int cnt = 0;
- memset(marker, 0, sizeof(marker));
- for(int temp_i = start; temp_i <= i; temp_i++){
- for(int temp_j = edn; temp_j <= j; temp_j++){
- marker[ara[temp_i][temp_j]]++;
- // cout << ara[temp_i][temp_j] << " ";
- }
- // cout << endl;
- }
- // cout << endl;
- // cout << endl;
- int flag = 0;
- for(int ii = 1; ii < 10; ii++){
- if(marker[ii] == 1){
- cnt++;
- }
- }
- if(cnt == 9){
- if(marker[10] >= 1){
- flag = 1;
- }
- }
- if(flag == 1){
- ans++;
- }
- }
- }
- }
- }
- printf("Case %d: %d\n", tr, ans);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement