Untitled

mail@pastecode.io avatar
unknown
plain_text
a year ago
21 kB
0
Indexable
Never
#include <iostream>
using namespace std;
int main(){
	freopen("input.txt","r",stdin);
	int T,x;
	cin>>T;
	for (x = 0; x < T; x++){
		int T1;
		cin>>T1;
		int i, j, A[100][100];
		for (i = 0; i < 100; i++){
			for (j = 0; j < 100; j++){
				cin>> A[i][j];
			}
		}
		int dem = 0;
		for ( i = 0; i < 100; i++){
			for (j = 0; j < 100; j++){
				if (A[i][j] == 1){
					int t = j;
					while (t < 99){
						if (A[i][t+1] == 2){
							A[i][t+1] = 0;
							A[i][j] = 0;
							break;
						}
						t++;
					}
				}
			}
		}
		for ( i = 0; i < 100; i++){
			for (j = 0; j < 100; j++){
				if (A[i][j] != 0){
					dem++;
				}
			}
		}
		cout<<"#"<<T1<<" "<<dem<<endl;
	}
	return 0;
}
/*
50
1
1 0 0 0 0 0 0 0 2 0 0 0 1 0 1 1 0 2 0 0 1 0 2 0 2 2 1 0 0 0 0 0 1 0 0 2 0 0 0 0 0 1 2 0 0 0 1 1 0 0 0 0 2 0 0 0 0 1 0 0 0 0 0 2 0 0 0 2 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 2 0 1
0 0 0 0 0 0 0 0 0 0 1 0 0 2 0 0 0 0 0 2 0 0 1 0 0 0 0 0 1 2 0 0 1 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 1 0 2 0 0 0 0 0 0 1 2 0 0 0 0 0 0 0 0 1 2 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0
0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 2 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 2 2 0 2 0 0 0 0 0 1 0 0 0 1 2 0 2 0 0 0 2 0 0 0 0 2 0 0 1 0 2 1 1 0 0 0 2 0 0 2 0 0 0 0 1 0 1 0 0 0 2 0 2 0 0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