Hello!
J'ai un petit problème, je me suis inscrit à une competition en ligne pour voir si j'arrive à gagner quelques points ( sur topcoder ) mais j'ai un problème dès le début : On doit faire une classe StreetSales dans laquelle une méthode sera appellée au début de chaque test (init) avec certains paramètres:
la representation d'une carte de la forme : string []carte
un tableau d'entier (pour le prix des objets dans le depot): int []prix
et deux autres machins qui n'ont rien à voir...
Donc je me demandais comment puis-je recuperer le nombres de lignes composant la carte ( pour les colonnes , c'est simple, j'ai juste à faire carte[0].size()) , de même pour le tableau prix, car si j'utilise sizeof, je trouverais la taille du pointeur, et non du tableau...
Merci d'avance
Partie de l'enoncé concerné:
Implementation
Your code should implement the following methods:
* init method is called once per test case to give you:
o the map of the district districtMap; 'X' marks a house and '.' marks a piece of street. You can walk on the streets, and you can trade at the house only if you stand at a street cell which is horizontally or vertically adjacent to it.
o warehouse prices per unit of goods of each type warehousePrices. You can figure out the number of distinct goods you can trade G as the number of elements in warehousePrices;
o the number of units of goods you can carry C;
o the number of steps you can perform per day S;
Definition
Class: StreetSales
Method: dayTrade
Parameters: int[]
Returns: String[]
Method signature: String[] dayTrade(int[] visitedHouses)
Method: init
Parameters: String[], int[], int, int
Returns: int
Method signature: int init(String[] districtMap, int[] warehousePrices, int C, int S)
(be sure your methods are public)
Partager