[ create a new paste ] login | about

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

C, pasted on Jun 20:
#include<iostream>
#include<algorithm>
using namespace std;

//"Điền các số từ 1 đến 9 vào ô trống để được kết quả đã cho"
int main()
{
	int a[10];
	int i;
	for(i = 0; i < 9; i++)
		a[i] = i + 1;
	do
	{
		int t = a[0] + 13 * a[1] / a[2] + a[3] + 12 * a[4] - a[5] - 11 + a[6] * a[7] / a[8] - 10;
		
		if((13 * a[1]) % a[2] != 0) continue;
	    if ((a[6] * a[7]) % a[8] != 0) continue;
		if(t == 66)
		{
			int j;
			for(j = 0; j < 9; j++){
				printf("%d ",a[j]);
		}
		printf("\n");
		}

	
	}while(next_permutation(a,a+9));

	system("pause");
	return 0;
}


Output:
1
2
3
Line 18: error: iostream: No such file or directory
Line 19: error: algorithm: No such file or directory
Line 3: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'namespace'


Create a new paste based on this one


Comments: