[PYTHON] AOJ Introduction à la programmation Sujet 1, Sujet 2, Sujet 3, Sujet 4

Sujet n ° 1

ITP1_1_A Hello World

Python


print("Hello World")

ITP1_1_B

x cubes

Python


n = int(input())
print(n**3)

ITP1_1_C

Zone et circonférence du rectangle

Python


h, w = list(map(int, input().split()))
print(f"{h * w} {h+h+w+w}")

ITP1_1_D

opérateur

Python


S = int(input())

h = S // 3600
m = S % 3600 // 60
s = S % 60
print(f"{h}:{m}:{s}")

Thème n ° 2

ITP1_2_A

Grande et petite relation

Python


a, b = list(map(int, input().split()))

if a<b:
    print("a < b")
elif a>b:
    print("a > b")
else:
    print("a == b")

ITP1_2_B

intervalle

Python


a, b, c = list(map(int, input().split()))

if a<b<c:
    print("Yes")
else:
    print("No")

ITP1_2_C

Alignement de trois nombres

Python


A = list(map(int, input().split()))

for i in range(1, len(A)):
    v = A[i]
    j = i - 1
    while j>=0 and A[j]>v:
        A[j+1]=A[j]
        j=j-1
    A[j+1]=v
    
for i in range(0, len(A)):
    if i<len(A)-1:
        print(f"{A[i]} ", end='')
    else:
        print(f"{A[i]}")

ITP1_2_D

Cercle dans un rectangle

Python


W, H, x, y, r = list(map(int, input().split()))

if 0<=x-r and x+r<=W and 0<=y-r and y+r<=H:
    print("Yes")
else:
    print("No")

Thème n ° 3

ITP1_3_A

Sortie de plusieurs Hello Worlds

Python


for i in range(0, 1000):
    print("Hello World")

ITP1_3_B

Sortie de cas de test

Python


n = 1
A = [0] * 1
while n > 0:
    n = int(input())
    A.append(n)
    
for i in range(1, len(A)):
    if A[i] != 0:
        print(f"Case {i}: {A[i]}")

ITP1_3_C

Échange de deux numéros

Python


while True:
    a, b = list(map(int, input().split()))
    
    if a==0 and b==0:
        break
    else:
        if a < b:
            print(f"{a} {b}")
        else:
            print(f"{b} {a}")

ITP1_3_D

Nombre de fractions

Python


a, b, c = list(map(int, input().split()))
ans=0
for i in range(a, b+1):
    if c % i == 0:
        ans += 1
print(ans)

Sujet n ° 4

ITP1_4_A

division

Python


a, b = list(map(int, input().split()))
print(f"{a//b} {a%b} {a/b:.5f}")

ITP1_4_B

Zone et circonférence du cercle

Python


import math as math
r = float(input())
print(f"{r*r*math.pi:.6f} {2*r*math.pi:.6f}")

ITP1_4_C

calculatrice

Python


while True:
    a, b, c = list(map(str, input().split()))
    a = int(a)
    c = int(c)
    
    if b=='?':
        break
    elif b=='+':
        print(f"{a+c}")
    elif b=='-':
        print(f"{a-c}")
    elif b=='*':
        print(f"{a*c}")
    elif b=='/':
        print(f"{a//c}")

ITP1_4_D

Valeur minimale, valeur maximale, valeur totale

Python


n = int(input())
a = list(map(int, input().split()))

Min = 1000000
Max = -1000000
Sum = 0
for i in range(0, n):
    Min = min(Min, a[i])
    Max = max(Max, a[i])
    Sum += a[i]
    
print(f"{Min} {Max} {Sum}")

Recommended Posts

AOJ Introduction à la programmation Sujet 1, Sujet 2, Sujet 3, Sujet 4
AOJ Introduction à la programmation Sujet n ° 7, Sujet n ° 8
AOJ Introduction à la programmation Sujet n ° 5, Sujet n ° 6
Une introduction à la programmation Python
[Introduction à Python3 Jour 1] Programmation et Python
Introduction à MQTT (Introduction)
Introduction à Scrapy (1)
Introduction à Scrapy (3)
Premiers pas avec Supervisor
Introduction à Tkinter 1: Introduction
Introduction à PyQt
Introduction à Scrapy (2)
[Linux] Introduction à Linux
Introduction à Scrapy (4)
Introduction à discord.py (2)
Une introduction à la programmation orientée objet pour les débutants par les débutants
Introduction à la programmation (Python) TA Tendency pour les débutants
Introduction à Lightning Pytorch
Premiers pas avec le Web Scraping
Introduction aux baies non paramétriques
Introduction à EV3 / MicroPython
Introduction au langage Python
Introduction à la reconnaissance d'image TensorFlow
Introduction à OpenCV (python) - (2)
Introduction à PyQt4 Partie 1
Introduction à l'injection de dépendances
Introduction à Private Chainer
Introduction à l'apprentissage automatique
Introduction au module de papier électronique
Introduction à l'algorithme de recherche de dictionnaire
Introduction à la méthode Monte Carlo
[Mémorandum d'apprentissage] Introduction à vim
Introduction à PyTorch (1) Différenciation automatique
opencv-python Introduction au traitement d'image
Introduction à Python Django (2) Win
Introduction à l'écriture de Cython [Notes]
Introduction à Private TensorFlow
Une introduction à l'apprentissage automatique
[Introduction à cx_Oracle] Présentation de cx_Oracle
Une super introduction à Linux
Introduction à la détection des anomalies 1 principes de base
Introduction à RDB avec sqlalchemy Ⅰ
[Introduction au système] Retracement de Fibonacci ♬
Introduction à l'optimisation non linéaire (I)
Introduction à la communication série [Python]
Une introduction à la programmation fonctionnelle pour améliorer l'efficacité du débogage en 1 minute
Collecte des problèmes de programmation (Q16 à Q20)
Introduction au Deep Learning ~ Règles d'apprentissage ~
[Introduction à Python] <liste> [modifier le 22/02/2020]
Introduction à Python (version Python APG4b)
[Introduction à cx_Oracle] (8e) version de cx_Oracle 8.0
Introduction à discord.py (3) Utilisation de la voix
Introduction à l'optimisation bayésienne
Apprentissage par renforcement profond 1 Introduction au renforcement de l'apprentissage
Super introduction à l'apprentissage automatique
Introduction à Ansible Part «Inventaire»