0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

全ての要素を用いた処理 (paizaランク D 相当)

Posted at

九九の問題からどうやって解くか難しかった

たとえば入力がこれだとすると

入力例2
5
1
2
3
4
5

Nは5なので(ちなみに必ず2以上)、すべてのペアをだす場合

A = 2 B = 1
A = 3 B = 1~2
A = 4 B = 1~3

と、要素数−1分ループさせることになるので
こうなる。
ちょっとループで混乱した。。。

N = int(input())
A = [int(input()) for _ in range(N)]
for i in range(N):
    for j in range(i):
            print(A[i]*A[j])

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?