[ create a new paste ] login | about

Link: http://codepad.org/pyihkLwP    [ raw code | output | fork ]

hoaithu.melody - C++, pasted on Mar 9:
//Magnetic
#include <iostream>
#include <conio.h>

using namespace std;

int main()
{
	freopen("Testcase.txt", "r", stdin);
	for(int testcase = 1; testcase <=10; testcase++)
	{
		int n, i, j;
		int matrix[100][100];
		cin >> n;
		for(i = 0; i < 100; i++)
			for(j = 0; j < 100; j++)
				cin >> matrix[i][j];

		int count = 0;
		for(i = 0; i < 100; i++)
			for(j = 0; j < 100; j++)
				if(matrix[j][i] == 1)
				{
					int k;
					for(k = j; k < 100; k++)
						if(matrix[k][i] == 2)
						{
							count++;
							j = k;
							break;
						}
				}

		cout << "#" << testcase << " " << count << endl;
	}
	getch();
	return 0;
}


Output:
1
2
3
4
Line 18: error: conio.h: No such file or directory
In function 'int main()':
Line 36: error: 'getch' was not declared in this scope
compilation terminated due to -Wfatal-errors.


Create a new paste based on this one


Comments: