Oui bien sûr, mais c'est du challenge codeingame.
Je montre la ligne qui bug avec le message d'erreur lors de la compilation.
J'ai essayé ces solutions-là:
1 2 3
| ParticipantTrie[i].add(sommeParticipant);
ParticipantTrie = ArrayUtils.add(sommeParticipant, i);
ParticipantTrie[i] = Array(sommeParticipant); |
Et l'erreur lors de la compilation pour le dernier:
error: cannot find symbol
ParticipantTrie = ArrayUtils.add(sommeParticipant, i);
Voilà ma boucle complète:
1 2 3 4 5 6 7 8 9 10 11 12 13
| for (int i = 0; i < Participant.size(); i++) {
sommeParticipant = (Participant.get(i)% N); //calcul la somme d'un participant
if(sommeParticipant == 0 ) {
System.out.println("IMPOSSIBLE"); //si le participant n'a pas d'argent
}else if(sommeParticipant > 0) {
//ParticipantTrie = Arrays.stream(array).mapToInt(Integer::intValue).toArray(Participant);
// ParticipantTrie[i] = Array(sommeParticipant);
ParticipantTrie = ArrayUtils.add(sommeParticipant, i);
Arrays.sort(ParticipantTrie); //On trie notre tableau dans l'ordre croissant
}
} |
Mais je ne trouve pas comment je pourrai affecter mes valeurs à mon tableau pour chaque indice+1 .
Partager