The input data consist of a single integer n (1 ≤ n ≤ 109),where n is the index number of an array(whose starting index is 1),n is till where sequence should be stored. The sequence to be stored is: 1 2 3 4 5 1 1 2 2 3 3 4 4 5 5 1 1 1 2 2 2 3 3 3 4 4 4 5 5 5 1 1 1 1 2 2 2 2 ...till n.
So if n =10 then the array must consist 10 elements which are 1 2 3 4 5 1 1 2 2 3.
Would prefer if the code is written in C++. Thank you.
Aucun commentaire:
Enregistrer un commentaire