SHOW:
|
|
- or go back to the newest paste.
1 | """ | |
2 | d88888b d8888b. .d8b. d8b db .o88b. d88888b d888888b .d88b. d888888b | |
3 | 88' 88 `8D d8' `8b 888o 88 d8P Y8 88' `88' .8P Y8. `88' | |
4 | 88ooo 88oobY' 88ooo88 88V8o 88 8P 88ooooo 88 88 88 88 | |
5 | 88~~~ 88`8b 88~~~88 88 V8o88 8b 88~~~~~ C8888D 88 88 88 88 | |
6 | 88 88 `88. 88 88 88 V888 Y8b d8 88. .88. `8b d8' .88. | |
7 | YP 88 YD YP YP VP V8P `Y88P' Y88888P Y888888P `Y88P' Y888888P | |
8 | """ | |
9 | ||
10 | # Credit à @sahhquelplaisir sur France-IOI | |
11 | # Plus qu'à copier/coller, tout est déjà fait ! Solution de pratiquement tout le niveau 1 (55 challenges sur 70) | |
12 | ||
13 | # ---------------------------------------------------------------------------------------------------------------- | |
14 | ||
15 | # Hello World | |
16 | ||
17 | print("Hello world!") | |
18 | ||
19 | # Présentation | |
20 | ||
21 | print("Coucou !") | |
22 | print("Je m'appelle Camthalion") | |
23 | print("Ma devise est 'Parler peu mais parler bien'.") | |
24 | ||
25 | # Plan de la montagne | |
26 | ||
27 | print("Tout droit tu grimperas,") | |
28 | print("La clé tu trouveras,") | |
29 | print("Habile tu seras,") | |
30 | print("Quand tu les porteras,") | |
31 | print("Et avec le chef tu reviendras !") | |
32 | ||
33 | # Dans le fourré | |
34 | ||
35 | from robot import * | |
36 | ||
37 | haut() | |
38 | haut() | |
39 | haut() | |
40 | droite() | |
41 | droite() | |
42 | bas() | |
43 | bas() | |
44 | droite() | |
45 | ||
46 | # Empilement de cylindres | |
47 | ||
48 | from robot import * | |
49 | ||
50 | deplacer(1, 2) | |
51 | deplacer(1, 3) | |
52 | deplacer(2, 3) | |
53 | deplacer(1, 2) | |
54 | deplacer(3, 1) | |
55 | deplacer(3, 2) | |
56 | deplacer(1, 2) | |
57 | deplacer(1, 3) | |
58 | deplacer(2, 3) | |
59 | deplacer(2, 1) | |
60 | deplacer(3, 1) | |
61 | deplacer(2, 3) | |
62 | deplacer(1, 2) | |
63 | deplacer(1, 3) | |
64 | deplacer(2, 3) | |
65 | ||
66 | # Recette secrète | |
67 | ||
68 | from robot import * | |
69 | ||
70 | remplir(3) | |
71 | transferer(3, 5) | |
72 | remplir(3) | |
73 | transferer(3, 5) | |
74 | vider(5) | |
75 | transferer(3, 5) | |
76 | remplir(3) | |
77 | transferer(3, 5) | |
78 | ||
79 | # Punition | |
80 | ||
81 | for loop in range(135): | |
82 | print("Je dois respecter le Grand Sorcier.") | |
83 | ||
84 | # Mathématiques de base | |
85 | ||
86 | for loop in range(13): | |
87 | print("9 * 8 = 72") | |
88 | ||
89 | # Transport d'eau | |
90 | ||
91 | from robot import * | |
92 | ||
93 | for loop in range(2): | |
94 | gauche() | |
95 | ||
96 | print("Bonjour, laissez-moi vous aider") | |
97 | ramasser() | |
98 | for loop in range(32): | |
99 | droite() | |
100 | ||
101 | deposer() | |
102 | ||
103 | # Le secret du Goma | |
104 | ||
105 | from robot import * | |
106 | ||
107 | for loop in range(15): | |
108 | droite() | |
109 | ramasser() | |
110 | ||
111 | droite() | |
112 | deposer() | |
113 | ||
114 | # Sisyphe | |
115 | ||
116 | from robot import * | |
117 | ||
118 | for loop in range(21): | |
119 | haut() | |
120 | droite() | |
121 | ||
122 | for loop in range(21): | |
123 | gauche() | |
124 | bas() | |
125 | ||
126 | # Page d'écriture | |
127 | ||
128 | for loop in range(30): | |
129 | print("a_", end = "") | |
130 | print("") | |
131 | ||
132 | for loop in range(30): | |
133 | print("b_", end = "") | |
134 | print("") | |
135 | ||
136 | for loop in range(30): | |
137 | print("c_", end = "") | |
138 | print("") | |
139 | ||
140 | # Jeu de dames | |
141 | ||
142 | for loop in range(20): | |
143 | for loop in range(20): | |
144 | print("OX", end = "") | |
145 | print("") | |
146 | for loop in range(20): | |
147 | print("XO", end = "") | |
148 | print("") | |
149 | ||
150 | # Mont Kailash | |
151 | ||
152 | from robot import * | |
153 | ||
154 | for loop in range(108): | |
155 | for loop in range(13): | |
156 | haut() | |
157 | for loop in range(13): | |
158 | droite() | |
159 | for loop in range(13): | |
160 | bas() | |
161 | for loop in range(13): | |
162 | gauche() | |
163 | ||
164 | # Vendanges | |
165 | ||
166 | from robot import * | |
167 | ||
168 | for loop in range(20): | |
169 | ramasser() | |
170 | for loop in range(15): | |
171 | droite() | |
172 | deposer() | |
173 | for loop in range(15): | |
174 | gauche() | |
175 | ||
176 | # Le Grand évènement | |
177 | ||
178 | from robot import * | |
179 | ||
180 | for loop in range(9): | |
181 | haut() | |
182 | for loop in range(9): | |
183 | droite() | |
184 | for loop in range(4): | |
185 | bas() | |
186 | for loop in range(8): | |
187 | gauche() | |
188 | bas() | |
189 | for loop in range(8): | |
190 | droite() | |
191 | bas() | |
192 | for loop in range(9): | |
193 | gauche() | |
194 | ||
195 | # Réponds ! | |
196 | ||
197 | print(42) | |
198 | ||
199 | # L'éclipse | |
200 | ||
201 | print(12581 - 11937) | |
202 | ||
203 | # Bonbons pour tout le monde ! | |
204 | ||
205 | eleves = 25 + 30 + 27 + 22 | |
206 | total = eleves - 8 | |
207 | print(total * 3) | |
208 | ||
209 | # L'algoréathlon | |
210 | ||
211 | distance = 2 + 34 + 6 | |
212 | print(distance, end = " ") | |
213 | print(distance * 2, end = " ") | |
214 | print(distance * 3, end = " ") | |
215 | ||
216 | # Cour de récréation | |
217 | ||
218 | longueur = 5*17 + 2*7 + 5 + 2*2 | |
219 | aire = longueur*longueur | |
220 | perimetre = 4*longueur | |
221 | ||
222 | print(aire) | |
223 | print(perimetre) | |
224 | ||
225 | # Une partie de cache-cache | |
226 | ||
227 | chiffre = 1 | |
228 | while chiffre < 101: | |
229 | print(chiffre) | |
230 | chiffre = chiffre + 1 | |
231 | print("J'arrive !") | |
232 | ||
233 | # Progresser par l'erreur | |
234 | ||
235 | print("V") | |
236 | print("V") | |
237 | print("I") | |
238 | print("I") | |
239 | print("V") | |
240 | print("I") | |
241 | print("I") | |
242 | ||
243 | # Décollage de fusée | |
244 | ||
245 | chiffre = 100 | |
246 | while chiffre != 0: | |
247 | print(chiffre) | |
248 | chiffre = chiffre - 1 | |
249 | print("0") | |
250 | print("Décollage !") | |
251 | ||
252 | # Invasion de batraciens | |
253 | ||
254 | crapauds = 1337 | |
255 | for loop in range(12): | |
256 | crapauds = crapauds * 2 | |
257 | ||
258 | print(crapauds) | |
259 | ||
260 | # Kermesse | |
261 | ||
262 | nombre = 1 | |
263 | tour = 1 | |
264 | print(nombre) | |
265 | while tour < 50: | |
266 | tour = tour + 1 | |
267 | nombre = nombre + tour | |
268 | print(nombre) | |
269 | ||
270 | # Course avec les enfants | |
271 | ||
272 | from robot import * | |
273 | distance = 1 | |
274 | ||
275 | for loop in range(10): | |
276 | for loop in range(distance): | |
277 | droite() | |
278 | ramasser() | |
279 | for loop in range(distance): | |
280 | gauche() | |
281 | deposer() | |
282 | distance = distance + 1 | |
283 | ||
284 | # Construction d'une pyramide | |
285 | ||
286 | nombre = 17 | |
287 | temp = 0 | |
288 | total = 0 | |
289 | ||
290 | for loop in range(9): | |
291 | temp = nombre * nombre * nombre | |
292 | total = total + temp | |
293 | nombre = nombre - 2 | |
294 | ||
295 | print(total) | |
296 | ||
297 | # Table de multiplication | |
298 | ||
299 | nombre = 1 | |
300 | const = 1 | |
301 | const2 = 1 | |
302 | mult = 1 | |
303 | result = 1 | |
304 | ||
305 | for loop in range(20): | |
306 | nombre = const | |
307 | mult = const2 | |
308 | for loop in range(20): | |
309 | result = nombre * mult | |
310 | print(result, end = " ") | |
311 | mult = mult + 1 | |
312 | print("") | |
313 | const = const + 1 | |
314 | ||
315 | # Récoltes | |
316 | ||
317 | taille = int(input()) | |
318 | taille = taille * taille | |
319 | total = taille * 23 | |
320 | print(total) | |
321 | ||
322 | # Retraite spirituelle | |
323 | ||
324 | jours = int(input()) | |
325 | temps = jours * 16 * 60 * 60 | |
326 | print(temps) | |
327 | ||
328 | # Âge des petits-enfants | |
329 | ||
330 | âgeCadet = int(input()) | |
331 | âgeAîné = int(input()) | |
332 | différence = âgeAîné - âgeCadet | |
333 | print(différence) | |
334 | ||
335 | # Encore des punitions | |
336 | ||
337 | lignes = int(input()) | |
338 | for loop in range(lignes): | |
339 | print("Je dois suivre en cours") | |
340 | ||
341 | # Graduation de thermomètres | |
342 | ||
343 | def print_between(start,stop): | |
344 | if start == stop: | |
345 | print(start) | |
346 | else: | |
347 | print(start) | |
348 | print_between(start + 1,stop) | |
349 | ||
350 | chiffre1 = int(input()) | |
351 | chiffre2 = int(input()) | |
352 | print_between(chiffre1,chiffre2) | |
353 | ||
354 | # Jeu de calcul mental | |
355 | ||
356 | num = int(input()) | |
357 | nombre = 66 | |
358 | choisi = 1 | |
359 | for loop in range(num): | |
360 | nombre = nombre * choisi | |
361 | print(nombre) | |
362 | choisi = choisi + 1 | |
363 | ||
364 | # La Grande Braderie | |
365 | ||
366 | depart = int(input()) | |
367 | distance = int(input()) | |
368 | recu = int(input()) | |
369 | ||
370 | recu1 = recu | |
371 | depart1 = depart | |
372 | temp = 0 | |
373 | ||
374 | print(depart) | |
375 | for loop in range(recu1): | |
376 | depart1 = depart1 + distance | |
377 | print(depart1) | |
378 | ||
379 | # Bétail | |
380 | ||
381 | temp1 = int(input()) | |
382 | temp2 = int(input()) | |
383 | temp3 = int(input()) | |
384 | temp4 = int(input()) | |
385 | temp5 = int(input()) | |
386 | temp6 = int(input()) | |
387 | temp7 = int(input()) | |
388 | temp8 = int(input()) | |
389 | temp9 = int(input()) | |
390 | temp10 = int(input()) | |
391 | temp11 = int(input()) | |
392 | temp12 = int(input()) | |
393 | temp13 = int(input()) | |
394 | temp14 = int(input()) | |
395 | temp15 = int(input()) | |
396 | temp16 = int(input()) | |
397 | temp17 = int(input()) | |
398 | temp18 = int(input()) | |
399 | temp19 = int(input()) | |
400 | temp20 = int(input()) | |
401 | ||
402 | total = temp1 + temp2 + temp3 + temp4 + temp5 + temp6 + temp7 + temp8 + temp9 + temp10 + temp11 + temp12 + temp13 + temp14 + temp15 + temp16 + temp17 + temp18 + temp19 + temp20 | |
403 | print(total) | |
404 | ||
405 | # Socles pour statues | |
406 | ||
407 | ent1 = int(input()) | |
408 | ent2 = int(input()) | |
409 | ent1c = 0 | |
410 | total = 0 | |
411 | total1 = 0 | |
412 | ||
413 | ent1c = ent1 | |
414 | for loop in range(ent1 - ent2 + 1): | |
415 | total = ent1c * ent1c | |
416 | total1 = total1 + total | |
417 | ent1c = ent1c - 1 | |
418 | print(total1) | |
419 | ||
420 | # Le plus beau Karva | |
421 | ||
422 | nombre = int(input()) | |
423 | for loop in range(nombre): | |
424 | poids = int(input()) | |
425 | age = int(input()) | |
426 | longueur = int(input()) | |
427 | hauteur = int(input()) | |
428 | note = longueur * hauteur + poids | |
429 | print(note) | |
430 | ||
431 | # Transport des bagages | |
432 | ||
433 | int1 = int(input()) | |
434 | int2 = int(input()) | |
435 | ||
436 | total = int1 * int2 | |
437 | if total > 105: | |
438 | print("Surcharge !") | |
439 | ||
440 | # Bornes kilométriques | |
441 | ||
442 | num1 = int(input()) | |
443 | num2 = int(input()) | |
444 | ||
445 | if num1 > num2: | |
446 | total = num1 - num2 | |
447 | else: | |
448 | total = num2 - num1 | |
449 | print(total) | |
450 | ||
451 | # Tarifs dégressifs | |
452 | ||
453 | heure = int(input()) | |
454 | prix = 10 | |
455 | ||
456 | heure = heure | |
457 | for loop in range(heure): | |
458 | prix = prix + 5 | |
459 | ||
460 | if prix > 53: | |
461 | prix = 53 | |
462 | print(prix) | |
463 | ||
464 | # Bagarre générale | |
465 | ||
466 | arignon = int(input()) | |
467 | evaran = int(input()) | |
468 | ||
469 | if arignon - evaran > 10: | |
470 | print("La famille Arignon a un champ trop grand") | |
471 | elif evaran - arignon > 10: | |
472 | print("La famille Evaran a un champ trop grand") | |
473 | ||
474 | # Tarif du bateau | |
475 | ||
476 | age = int(input()) | |
477 | ||
478 | if age >= 21: | |
479 | print("Tarif plein") | |
480 | else: | |
481 | print("Tarif réduit") | |
482 | ||
483 | # Traversée du pont | |
484 | ||
485 | de1 = int(input()) | |
486 | de2 = int(input()) | |
487 | ||
488 | somme = de1 + de2 | |
489 | if somme >= 10: | |
490 | print("Taxe spéciale !") | |
491 | print("36") | |
492 | else: | |
493 | somme = somme * 2 | |
494 | print("Taxe régulière") | |
495 | print(somme) | |
496 | ||
497 | # Concours de tir à la corde | |
498 | ||
499 | nbMembres = int(input()) | |
500 | poids1 = 0 | |
501 | poids2 = 0 | |
502 | temp = 0 | |
503 | ||
504 | for loop in range(nbMembres): | |
505 | temp = int(input()) | |
506 | poids1 = poids1 + temp | |
507 | temp = int(input()) | |
508 | poids2 = poids2 + temp | |
509 | ||
510 | if poids1 > poids2: | |
511 | print("L'équipe 1 a un avantage") | |
512 | else: | |
513 | print("L'équipe 2 a un avantage") | |
514 | print("Poids total pour l'équipe 1 :", poids1) | |
515 | print("Poids total pour l'équipe 2 :", poids2) | |
516 | ||
517 | # Mot de passe du village | |
518 | ||
519 | motdepasse = int(input()) | |
520 | ||
521 | if motdepasse == 64741: | |
522 | print("Bon festin !") | |
523 | else: | |
524 | print("Allez-vous en !") | |
525 | ||
526 | # Villes et villages | |
527 | ||
528 | nombre = int(input()) | |
529 | total = 0 | |
530 | ||
531 | for loop in range(nombre): | |
532 | temp = int(input()) | |
533 | if temp > 10000: | |
534 | total = total + 1 | |
535 | ||
536 | print(total) | |
537 | ||
538 | # Planning de la journée | |
539 | ||
540 | maintenant = int(input()) | |
541 | nbrvillages = int(input()) | |
542 | temp = 0 | |
543 | total = 0 | |
544 | ||
545 | for loop in range(nbrvillages): | |
546 | temp = int(input()) | |
547 | if maintenant - temp <= 50 and maintenant - temp >= 0: | |
548 | total = total + 1 | |
549 | elif maintenant - temp <= 0 and abs(maintenant - temp) <= 50: | |
550 | total = total + 1 | |
551 | ||
552 | print(total) | |
553 | ||
554 | # Étape la plus longue | |
555 | ||
556 | ent = int(input()) | |
557 | temp = 0 | |
558 | total = 0 | |
559 | ||
560 | for loop in range(ent): | |
561 | temp = int(input()) | |
562 | if temp > total: | |
563 | total = temp | |
564 | ||
565 | print(total) | |
566 | ||
567 | # Calcul des dénivelées | |
568 | ||
569 | nombre = int(input()) | |
570 | temp = 0 | |
571 | totalpos = 0 | |
572 | totalneg = 0 | |
573 | ||
574 | for loop in range(nombre): | |
575 | temp = int(input()) | |
576 | if temp > 0: | |
577 | totalpos = totalpos + temp | |
578 | else: | |
579 | totalneg = totalneg + temp | |
580 | ||
581 | print(totalpos) | |
582 | print(abs(totalneg)) | |
583 | ||
584 | # Type d'arbres | |
585 | ||
586 | taille1 = int(input()) | |
587 | taille2 = int(input()) | |
588 | total = "Arbre" | |
589 | ||
590 | if taille1 <= 5 and taille2 >= 8: | |
591 | total = "Tinuviel" | |
592 | elif taille1 >= 10 and taille2 >= 10: | |
593 | total = "Calaelen" | |
594 | elif taille1 >= 12 and taille2 <= 7: | |
595 | total = "Dorthonion" | |
596 | elif taille1 <= 8 and taille2 <= 5: | |
597 | total = "Falarion" | |
598 | ||
599 | print(total) | |
600 | ||
601 | # Tarifs de l'auberge | |
602 | ||
603 | age = int(input()) | |
604 | poids = int(input()) | |
605 | prix = 0 | |
606 | ||
607 | if age == 60: | |
608 | prix = 0 | |
609 | elif age < 10: | |
610 | prix = 5 | |
611 | else: | |
612 | prix = 30 | |
613 | if poids >= 20: | |
614 | prix = 40 | |
615 | ||
616 | print(prix) | |
617 | ||
618 | # Protection du village | |
619 | ||
620 | nombre = int(input()) | |
621 | abscisse = 0 | |
622 | ordonnee = 0 | |
623 | taillex = 0 | |
624 | tailley = 0 | |
625 | temp1 = 0 | |
626 | temp2 = 0 | |
627 | ||
628 | abscisse = int(input()) | |
629 | ordonnee = int(input()) | |
630 | maxo = ordonnee | |
631 | mino = ordonnee | |
632 | maxa = abscisse | |
633 | mina = abscisse | |
634 | ||
635 | for loop in range(nombre - 1): | |
636 | abscisse = int(input()) | |
637 | ordonnee = int(input()) | |
638 | if abscisse > maxa: | |
639 | maxa = abscisse | |
640 | if abscisse < mina: | |
641 | mina = abscisse | |
642 | if ordonnee > maxo: | |
643 | maxo = ordonnee | |
644 | if ordonnee < mino: | |
645 | mino = ordonnee | |
646 | ||
647 | taillex = maxa - mina | |
648 | tailley = maxo - mino | |
649 | temp1 = taillex * 2 | |
650 | temp2 = tailley * 2 | |
651 | print(temp1 + temp2) | |
652 | ||
653 | # Le juste prix | |
654 | ||
655 | numero = int(input()) | |
656 | etape = 1 | |
657 | temp = 0 | |
658 | total = 0 | |
659 | ||
660 | temp = int(input()) | |
661 | resultat = temp | |
662 | total = etape | |
663 | ||
664 | for loop in range(numero - 1): | |
665 | temp = int(input()) | |
666 | etape = etape + 1 | |
667 | if temp <= resultat: | |
668 | total = etape | |
669 | resultat = temp | |
670 | ||
671 | print(total) | |
672 | ||
673 | # Espion étranger | |
674 | ||
675 | debut = int(input()) | |
676 | fin = int(input()) | |
677 | entrees = int(input()) | |
678 | total = 0 | |
679 | ||
680 | for loop in range(entrees): | |
681 | temp = int(input()) | |
682 | if (temp >= debut) and (temp <= fin): | |
683 | total = total + 1 | |
684 | ||
685 | print(total) | |
686 | ||
687 | # Maison de l'espion | |
688 | ||
689 | amin = int(input()) | |
690 | amax = int(input()) | |
691 | omin = int(input()) | |
692 | omax = int(input()) | |
693 | maisons = int(input()) | |
694 | tempa = 0 | |
695 | tempo = 0 | |
696 | total = 0 | |
697 | ||
698 | for loop in range(maisons): | |
699 | tempa = int(input()) | |
700 | tempo = int(input()) | |
701 | if (tempa >= amin) and (tempa <= amax) and (tempo >= omin) and (tempo <= omax): | |
702 | total = total + 1 | |
703 | ||
704 | print(total) | |
705 | ||
706 | # Nombre de jours dans le mois | |
707 | ||
708 | mois = int(input()) | |
709 | ||
710 | if ( (mois >= 1) and (mois < 4) ) or ( (mois >= 7) and (mois < 10) ): | |
711 | print(30) | |
712 | elif ( (mois >= 4) and (mois < 7) ) or (mois == 10): | |
713 | print(31) | |
714 | else: | |
715 | print(29) | |
716 | ||
717 | # Amitié entre gardes | |
718 | ||
719 | arria = int(input()) | |
720 | parta = int(input()) | |
721 | arrib = int(input()) | |
722 | partb = int(input()) | |
723 | ||
724 | if ( ( (arria >= arrib) and (arria <= partb) ) or ( (parta >= arrib) and (parta <= partb) ) ) or ( ( (arrib >= arria) and (arrib <= parta) ) or ( (partb >= arria) and (partb <= arria) ) ): | |
725 | print("Amis") | |
726 | else: | |
727 | print("Pas amis") | |
728 | ||
729 | # Nombre de personnes à la fête | |
730 | ||
731 | personnes = int(input()) | |
732 | temp = 0 | |
733 | total1 = 0 | |
734 | total = 0 | |
735 | ||
736 | for loop in range(personnes * 2): | |
737 | temp = int(input()) | |
738 | if temp >= 0: | |
739 | total1 = total1 + 1 | |
740 | if total1 > total: | |
741 | total = total + 1 | |
742 | else: | |
743 | total1 = total1 - 1 | |
744 | if total1 > total: | |
745 | total = total + 1 | |
746 | ||
747 | print(total) |