Améliorer votre expérience CodeS-SourceS avec ce plugin:
http://codes-sources.commentcamarche.net/forum/affich-10000111-plugin-better-cs-2#cptpingu-signature
Vous n’avez pas trouvé la réponse que vous recherchez ?
Posez votre question500 heure c'est que moins de 2 mois en fesent 12 heure par jours
toi tu a travaille combien d'heures de pratique
tres jeune sait quoi pour toi
#include <stdlib.h> #include <stdio.h> #include <string.h> /** * Auto-generated code below aims at helping you parse * the standard input according to the problem statement. * --- * Hint: You can use the debug stream to print initialTX and initialTY, if Thor seems not follow your orders. **/ int main() { int lightX; // the X position of the light of power int lightY; // the Y position of the light of power int initialTX; // Thor's starting X position int initialTY; // Thor's starting Y position scanf("%d%d%d%d", &lightX, &lightY, &initialTX, &initialTY); // game loop while (1) { int remainingTurns; // The remaining amount of turns Thor can move. Do not remove this line. scanf("%d", &remainingTurns); int thorY = 0; int thorX = 0; thorX = initialTX; thorY = initialTY; while (remainingTurns) { char* directionX = ""; char* directionY = ""; if (thorY > lightY) { directionY = "N"; thorY - 1; } else if (thorY < lightY) { directionY = "S"; thorY + 1; } if(thorX > lightX) { directionX = "W"; thorX - 1; } else if (thorX < lightX) { directionX = "E"; thorX + 1; } printf("%s\n", directionX) || printf("%s\n", directionY); } // Write an action using printf(). DON'T FORGET THE TRAILING \n // To debug: fprintf(stderr, "Debug messages...\n"); // A single line providing the move to be made: N NE E SE S SW W or NW } return 0; }