arrow_forward همه ارسال‌ها

جزئیات ارسال کد#187

verified
وضعیت داوری نهایی: پذیرفته شد
terminal
زبان برنامه‌نویسی: Python
schedule
ارسال‌کننده و زمان:
Mojtaba Salehi (۳ سال پیش)
descriptionsolution.py ۱۱ خط • ۳۱۱ بایت
1n = int(input())
2buildings = input().split()
3buildings = [int(i) for i in buildings]
4wires = 0
5for i in range(len(buildings)):
6 first = buildings[i]
7 for j in range(i + 1, len(buildings)):
8 second = buildings[j]
9 if second == first:
10 wires = wires + j - i
11print(wires)
کد ارسال‌شده برای داوری خودکار هاتکدز UTF-8