/* ************************************************************************** */
/*                                                                            */
/*                                                        :::      ::::::::   */
/*   ft_ten_queens_puzzle.c                             :+:      :+:    :+:   */
/*                                                    +:+ +:+         +:+     */
/*   By: ablaamim <ablaamim@student.1337.ma>        +#+  +:+       +#+        */
/*                                                +#+#+#+#+#+   +#+           */
/*   Created: 2021/10/14 02:27:39 by ablaamim          #+#    #+#             */
/*   Updated: 2021/10/14 02:37:01 by ablaamim         ###   ########.fr       */
/*                                                                            */
/* ************************************************************************** */

#include <unistd.h>

long	g_answers[] = {
	257948136,
	258693147,
	258693174,
	286931475,
	358297146,
	369184275,
	369281475,
	369581427,
	369714258,
	369724815,
	369741825,
	384792516,
	386192574,
	386925147,
	396824175,
	461973825,
	469318257,
	471692853,
	479261358,
	479631852,
	495813627,
	536928147,
	536971428,
	538629147,
	539682417,
	571682493,
	572681493,
	574182963,
	579382461,
	582731946,
	582963147,
	584973162,
	586137942,
	592683147,
	615793824,
	635819427,
	639714258,
	641792853,
	647185293,
	681592473,
	681742953,
	682713594,
	685297413,
	695184273,
	716824935,
	716924835,
	718529364,
	736814952,
	736815924,
	738629514,
	741829635,
	751693842,
	751863924,
	752813964,
	752814936,
	758293641,
	796318524,
	849731625,
	851692473,
	852974136,
	861379425,
	862714953,
	946827135,
	964718253,
	1357902468,
	1372859064,
	1379485026,
	1386490572,
	1396852074,
	1460958273,
	1463928570,
	1468370259,
	1470692538,
	1473692058,
	1475296038,
	1475820369,
	1475820639,
	1479258036,
	1480936275,
	1483975206,
	1497036258,
	1526908473,
	1526974038,
	1529748306,
	1572084936,
	1572639084,
	1580742963,
	1586902473,
	1592683047,
	1642839750,
	1647039258,
	1682793504,
	1693074258,
	1695084273,
	1695203748,
	1728649053,
	1748059263,
	1758203649,
	1792853064,
	1793048526,
	1807429635,
	1827935046,
	1829630475,
	1849035726,
	1850296374,
	1852930746,
	1857902463,
	1862974035,
	1869304752,
	1926830475,
	1963028574,
	1972480536,
	2058497316,
	2417963085,
	2418596307,
	2469350817,
	2470831695,
	2471860359,
	2480596137,
	2481963075,
	2483097516,
	2483591607,
	2483961570,
	2497316850,
	2519084736,
	2539084716,
	2570369184,
	2574039681,
	2579084136,
	2579304186,
	2580369147,
	2580369714,
	2580731649,
	2580946137,
	2581369704,
	2581369740,
	2581703649,
	2584703169,
	2586031479,
	2586137049,
	2586307149,
	2594186307,
	2594186370,
	2596137048,
	2613794850,
	2617509483,
	2619753804,
	2683049157,
	2683509147,
	2693804175,
	2716094853,
	2736814059,
	2750814639,
	2750946831,
	2751840396,
	2751940386,
	2758094613,
	2758140369,
	2790514683,
	2793804615,
	2817469053,
	2819460357,
	2857130649,
	2859160374,
	2918530746,
	2936815704,
	2938046157,
	2951840736,
	2951863704,
	2961307485,
	2963041857,
	2963185047,
	2964085713,
	2968041753,
	2970415863,
	2971386405,
	2974130685,
	3047926815,
	3068174295,
	3069518427,
	3075196824,
	3079152864,
	3147925860,
	3148097526,
	3164908572,
	3168520974,
	3169508427,
	3172864905,
	3174805926,
	3175804692,
	3179025864,
	3179625804,
	3184975206,
	3185297046,
	3185960247,
	3195847026,
	3508627149,
	3509468271,
	3509647182,
	3528174690,
	3529168074,
	3529607418,
	3529641807,
	3571408692,
	3579162084,
	3579168024,
	3582071469,
	3582961740,
	3582971460,
	3584902716,
	3584906172,
	3592074186,
	3592471860,
	3594172680,
	3594602718,
	3605197248,
	3605817429,
	3625190847,
	3629508471,
	3629518407,
	3642097581,
	3649157208,
	3681470295,
	3681502479,
	3685140792,
	3685190247,
	3685207419,
	3691470258,
	3692470815,
	3692470851,
	3692814750,
	3704815926,
	3704915286,
	3708146925,
	3708516924,
	3724690518,
	3724805916,
	3724805961,
	3724815960,
	3724908516,
	3728590641,
	3728690514,
	3741596028,
	3741906825,
	3742091586,
	3742096851,
	3742951860,
	3742961580,
	3748091526,
	3748096251,
	3792514086,
	3794150268,
	3804915726,
	3825190647,
	3827905146,
	3829164075,
	3841905726,
	3842096157,
	3847025169,
	3849057162,
	3862051497,
	3864150972,
	3908526174,
	3925817460,
	3941862750,
	3942861750,
	3961520748,
	3964170285,
	3974205186,
	3974206158,
	4038619257,
	4053972861,
	4073681592,
	4075186392,
	4075281396,
	4079258136,
	4079631852,
	4083579162,
	4085269713,
	4138279605,
	4139680275,
	4139685207,
	4150968273,
	4152968307,
	4159268370,
	4179285306,
	4179620835,
	4179630852,
	4180279635,
	4196302857,
	4208619753,
	4209683175,
	4258136970,
	4258170369,
	4258603179,
	4259613708,
	4259630718,
	4273609158,
	4275180369,
	4279130685,
	4283179605,
	4283975160,
	4285713069,
	4285916037,
	4286130975,
	4286915703,
	4293681570,
	4295186370,
	4295380716,
	4296158073,
	4296308157,
	4603582971,
	4605713829,
	4609582731,
	4615703829,
	4619703825,
	4619730285,
	4630279185,
	4630718529,
	4630752918,
	4639258170,
	4680279135,
	4682519703,
	4682713509,
	4682730915,
	4683179205,
	4685209713,
	4693182570,
	4695207318,
	4702586931,
	4703581926,
	4708619253,
	4713908526,
	4713968520,
	4716208359,
	4716258093,
	4716920835,
	4718520369,
	4730286915,
	4730619582,
	4736920581,
	4738620519,
	4750268319,
	4752916830,
	4758203691,
	4790258613,
	4802619753,
	4803179625,
	4809362751,
	4809627135,
	4813702596,
	4815720369,
	4819257036,
	4819630752,
	4835916027,
	4905317286,
	4930271685,
	4930286175,
	4938271605,
	4953168207,
	4953172860,
	4970286135,
	5029713864,
	5046827139,
	5046831792,
	5061728394,
	5069713824,
	5069728314,
	5094682713,
	5164083972,
	5180369247,
	5180742963,
	5184279630,
	5186297403,
	5190372864,
	5190637248,
	5196820374,
	5197380246,
	5209741386,
	5241796308,
	5247083169,
	5249731680,
	5261379480,
	5263079418,
	5269380417,
	5269713084,
	5281479630,
	5283079164,
	5283741906,
	5283791640,
	5286031479,
	5286091473,
	5291380746,
	5296418073,
	5297413068,
	5304792681,
	5306817429,
	5314790286,
	5316820794,
	5317269084,
	5317286490,
	5317480296,
	5319720864,
	5360741829,
	5369247081,
	5369281470,
	5369720814,
	5380269714,
	5380296174,
	5384296170,
	5390417268,
	5394286170,
	5396417028,
	5703691842,
	5703841926,
	5704619283,
	5704813629,
	5706318429,
	5713084296,
	5713869024,
	5714083962,
	5714286930,
	5716024839,
	5716820394,
	5720869314,
	5724819630,
	5726390841,
	5740369281,
	5740386291,
	5741396820,
	5741829630,
	5741863029,
	5790316824,
	5791380246,
	5803697142,
	5819720364,
	5820369147,
	5820379164,
	5820714693,
	5840731629,
	5847031692,
	5849031726,
	5860314792,
	5860319724,
	5861720394,
	5914730286,
	5916420837,
	5920368147,
	5920741863,
	5924718603,
	5924813607,
	5926318407,
	5946027138,
	5961380742,
	6025793841,
	6025794813,
	6035829714,
	6038479251,
	6057138249,
	6058137249,
	6074182539,
	6091473825,
	6135849027,
	6137948502,
	6150942837,
	6152974830,
	6157903842,
	6158094273,
	6170835924,
	6172094853,
	6174809352,
	6195084273,
	6205849731,
	6207485913,
	6251903748,
	6251908473,
	6257038419,
	6257048139,
	6257903148,
	6257908413,
	6258093174,
	6258403971,
	6271309485,
	6271409358,
	6275091483,
	6275184039,
	6275194038,
	6275194083,
	6275309481,
	6291483075,
	6291853074,
	6295084713,
	6295184073,
	6307185249,
	6307529148,
	6307529184,
	6308529741,
	6314792580,
	6314809752,
	6314859207,
	6318497520,
	6318529704,
	6350842791,
	6357902418,
	6370481592,
	6370491528,
	6374809152,
	6394182570,
	6394802751,
	6405397281,
	6405827319,
	6407528139,
	6407925813,
	6415093827,
	6415097283,
	6417028539,
	6417038259,
	6417928530,
	6420831975,
	6420837915,
	6428591307,
	6470358192,
	6470392581,
	6470831925,
	6471825309,
	6490352817,
	6490531728,
	6491372850,
	6804152973,
	6814039752,
	6814702953,
	6815024793,
	6820374195,
	6820974135,
	6824195307,
	6825194073,
	6827135094,
	6830491572,
	6831479025,
	6835091427,
	6851902473,
	6852074139,
	6920847135,
	6924803175,
	6930481572,
	6931825704,
	6952073184,
	7025869314,
	7028613594,
	7029584136,
	7031958246,
	7035914286,
	7036814952,
	7036958142,
	7038692514,
	7048136295,
	7048159263,
	7061953842,
	7063184295,
	7081469253,
	7140839625,
	7142869350,
	7180539642,
	7182530946,
	7206195384,
	7209485316,
	7241859630,
	7241905386,
	7248059613,
	7248159603,
	7249053168,
	7249185360,
	7263185940,
	7283905146,
	7306195824,
	7316490852,
	7316950842,
	7380246195,
	7382490516,
	7386205149,
	7403862951,
	7405813629,
	7405813692,
	7413692850,
	7413862950,
	7413968520,
	7415296830,
	7418296350,
	7418630259,
	7418630295,
	7419053862,
	7419268350,
	7419630285,
	7419630852,
	7420695813,
	7420915863,
	7425960318,
	7429630815,
	7460915283,
	7480915263,
	7502683149,
	7516038429,
	7516408392,
	7516902483,
	7518036924,
	7519403862,
	7528139640,
	7529168304,
	7530649182,
	7581403692,
	7582036914,
	7941502683,
	8027519463,
	8036971425,
	8073169524,
	8130695247,
	8137025964,
	8142097536,
	8147069253,
	8149703625,
	8150964273,
	8170369524,
	8172064953,
	8192570364,
	8206951473,
	8207146935,
	8241796350,
	8251940736,
	8271350946,
	8304796251,
	8304915726,
	8306925741,
	8317206495,
	8352960741,
	8357160249,
	8407316952,
	8413097526,
	8419257036,
	8427360915,
	8427915063,
	8470251693,
	8473025961,
	8473091526,
	8502963741,
	8516024793,
	8519063724,
	8520741963,
	8524179360,
	8524179630,
	8524703961,
	8526307941,
	8529307461,
	8531629740,
	8536071429,
	8539041726,
	8603147925,
	8613509427,
	8620514973,
	8627140935,
	8642097531,
	9035281746,
	9053172864,
	9137285046,
	9138620574,
	9147025863,
	9148307526,
	9150268374,
	9203681475,
	9241706358,
	9247185063,
	9247186035,
	9248136075,
	9248306157,
	9258170364,
	9261370485,
	9263184075,
	9263185047,
	9281470635,
	9283075164,
	9283175064,
	9304815726,
	9314702586,
	9317286405,
	9318257046,
	9318407526,
	9352814706,
	9358207146,
	9360285741,
	9364180572,
	9384206175,
	9407316852,
	9413862057,
	9415026837,
	9417036852,
	9417268053,
	9420617538,
	9425817036,
	9427318506,
	9428317506,
	9460317582,
	9461370852,
	9463028571,
	9463071852,
	9504186372,
	9520368147,
	9520738641,
	9528307146,
	9530681742,
	9538026174,
	9603175824,
	9613074852,
	9613807425,
	9615207483,
	9630258174,
	9630275184,
	9630285741,
	9630418572,
	9630718524,
	9630815724,
	9641702853,
	9713068524,
	9741306825,
	9741306852,
	9742051863
};

void	ft_putchar(char c)
{
	write(1, &c, 1);
}

void	ft_putnbr(long nb)
{
	int		i;
	char	digits[10];

	i = 9;
	while (i > -1)
	{
		digits[i] = (nb % 10) + '0';
		nb /= 10;
		i--;
	}
	i = 0;
	while (i < 10)
	{
		ft_putchar(digits[i]);
		i++;
	}
}

int	ft_ten_queens_puzzle(void)
{
	int	i;

	i = 0;
	while (i < 724)
	{
		ft_putnbr(g_answers[i]);
		ft_putchar('\n');
		i++;
	}
	return (724);
}
