gpt-3.5-turbo-0613· OpenAI
WildChat-4.8M (AI2)
#include <bits/stdc++.h> using namespace std; int main() { #ifdef _DEBUG…
- User
#include <bits/stdc++.h>
using namespace std;
int main() { #ifdef _DEBUG freopen("input.txt", "r", stdin); // freopen("output.txt", "w", stdout); #endif
int t; cin >> t; while (t--) { string x; cin >> x; int dig = x[0] - '0' - 1; int len = x.size(); cout << dig * 10 + len * (len + 1) / 2 << endl; } return 0;} Перепиши этот код на питон
- Assistant
t = int(input()) for _ in range(t): x = input() dig = int(x[0]) - 1 length = len(x) print(dig * 10 + length * (length + 1) // 2)