Table of Contents


正文

【CodinGame】随笔 - 趣味算法(教学用) CLASH OF CODE -20240805_AI系列

import sys
import math

# Auto-generated code below aims at helping you parse
# the standard input according to the problem statement.

s = input()
news=""

for c in s:
    if c.isalpha() or c==" ":
        news+=c
print(news)
  • 1.
  • 2.
  • 3.
  • 4.
  • 5.
  • 6.
  • 7.
  • 8.
  • 9.
  • 10.
  • 11.
  • 12.
  • 13.

【CodinGame】随笔 - 趣味算法(教学用) CLASH OF CODE -20240805_AI系列_02

import sys
import math

# Auto-generated code below aims at helping you parse
# the standard input according to the problem statement.

x = int(input())
y = int(input())

print(x*(x+y))

  • 1.
  • 2.
  • 3.
  • 4.
  • 5.
  • 6.
  • 7.
  • 8.
  • 9.
  • 10.
  • 11.

【CodinGame】随笔 - 趣味算法(教学用) CLASH OF CODE -20240805_AI系列_03

import sys
import math

# Auto-generated code below aims at helping you parse
# the standard input according to the problem statement.

n = int(input())

print(n**2)

  • 1.
  • 2.
  • 3.
  • 4.
  • 5.
  • 6.
  • 7.
  • 8.
  • 9.
  • 10.

【CodinGame】随笔 - 趣味算法(教学用) CLASH OF CODE -20240805_AI系列_04

import sys
import math

# Auto-generated code below aims at helping you parse
# the standard input according to the problem statement.

_input = input()


print(len(_input),_input[::-1])
  • 1.
  • 2.
  • 3.
  • 4.
  • 5.
  • 6.
  • 7.
  • 8.
  • 9.
  • 10.

【CodinGame】随笔 - 趣味算法(教学用) CLASH OF CODE -20240805_AI系列_05

import sys
import math

# Auto-generated code below aims at helping you parse
# the standard input according to the problem statement.

n = int(input())

def factorial(n):
    if n == 0:
        return 1
    else:
        return n * factorial(n-1)
    
print(factorial(n))

  • 1.
  • 2.
  • 3.
  • 4.
  • 5.
  • 6.
  • 7.
  • 8.
  • 9.
  • 10.
  • 11.
  • 12.
  • 13.
  • 14.
  • 15.
  • 16.

【CodinGame】随笔 - 趣味算法(教学用) CLASH OF CODE -20240805_AI系列_06

import sys
import math

# Auto-generated code below aims at helping you parse
# the standard input according to the problem statement.

a = int(input())

# Write an answer using print
# To debug: print("Debug messages...", file=sys.stderr, flush=True)

print(a*a-a)

  • 1.
  • 2.
  • 3.
  • 4.
  • 5.
  • 6.
  • 7.
  • 8.
  • 9.
  • 10.
  • 11.
  • 12.
  • 13.

写在最后

欢迎技术类的问题到 这里提出,我会逐个解答


END

本文由博客一文多发平台  OpenWrite 发布!