编号 题目 状态 分数 总时间 内存 代码 / 答案文件 提交者 提交时间
#5478 #1050. 求和 Wrong Answer 0 8273 ms 4356 K Python 3 / 4.3 K s230026152 2024-04-27 16:25:58
import re,os
from io import BytesIO, IOBase
import random
import sys
from math import ceil,floor,fmod,gcd,sqrt,inf
from bisect import bisect_left
from collections import defaultdict,Counter,deque,OrderedDict
# from functools import cache, reduce, cmp_to_key
from itertools import accumulate, combinations, permutations
from heapq import nsmallest, nlargest, heappushpop, heapify, heappop, heappush
from copy import deepcopy
from typing import *
from string import ascii_lowercase, ascii_uppercase
# 快读区块大小
BUFSIZE = 4096
# 判断是否本地
LOCAL="--open17" in sys.argv

# 可能会导致pypy产生TLE
# if "PyPy" in sys.version:
#     import pypyjit; pypyjit.set_param('max_unroll_recursion=-1')

# 调试递归极限
limits = [100000, 10000, 5000, 2000]
for limit in limits:
    try:
        sys.setrecursionlimit(limit)
        break
    except:
        continue 




class FastIO(IOBase):
    newlines = 0
    def __init__(self, file):
        self._fd = file.fileno()
        self.buffer = BytesIO()
        self.writable = "x" in file.mode or "r" not in file.mode
        self.write = self.buffer.write if self.writable else None
    def read(self):
        while True:
            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
            if not b:
                break
            ptr = self.buffer.tell()
            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
        self.newlines = 0
        return self.buffer.read()
    def readline(self):
        while self.newlines == 0:
            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
            self.newlines = b.count(b"\n") + (not b)
            ptr = self.buffer.tell()
            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
        self.newlines -= 1
        return self.buffer.readline()
    def flush(self):
        if self.writable:
            os.write(self._fd, self.buffer.getvalue())
            self.buffer.truncate(0), self.buffer.seek(0)
 
class IOWrapper(IOBase):
    def __init__(self, file):
        self.buffer = FastIO(file)
        self.flush = self.buffer.flush
        self.writable = self.buffer.writable
        self.write = lambda s: self.buffer.write(s.encode("ascii"))
        self.read = lambda: self.buffer.read().decode("ascii")
        self.readline = lambda: self.buffer.readline().decode("ascii")
 

def fstream(func):
    def wrapper(is_local):
        input_file = open('data.in', 'r', encoding='utf-8') if is_local else sys.stdin
        output_file = open('data.out', 'w', encoding='utf-8') if is_local else sys.stdout
        sys.stdin = IOWrapper(input_file)
        sys.stdout = output_file
        func()
        sys.stdin = sys.__stdin__
        sys.stdout = sys.__stdout__
        if is_local:
            input_file.close()
            output_file.close()
    return wrapper

input = lambda: sys.stdin.readline().rstrip("\r\n")

def I():
    return input()
 
def II():
    return int(input())
 
def MII():
    return map(int, input().split())
 
def LI():
    return list(input().split())
 
def LII():
    return list(map(int, input().split()))

def for_t(func):
    def wrapper():
        T=II()
        for _ in range(T):
            func()
    return wrapper



@fstream
@for_t
def solve():
    n=II()
    a=[]
    tmp=n
    # while n:
    #     a.append(n%10)
    #     n//=10
    # def f(a):
    #     if len(a)==1:
    #         return ((1+a[0])*a[0]//2)
    #     elif len(a)==2:
    #         return a[1]*f([9])+(a[0]+1)*a[1]+f(a[:-1])
    #     elif len(a)==3:
    #         return a[2]*f([9,9])+(a[1]*10+a[0]+1)*a[2]+f(a[:-2])
    #     elif len(a)==4:
    #         return a[3]*f([9,9,9])+(a[2]*100+a[1]*10+a[0]+1)*a[3]+f(a[:-3])
        # elif len(a)==5:
            # return a[4]*f([9,9,9,9])+(a[3]*1000+a[2]*100+a[1]*10+a[0]+1)*a[4]+f(a[4:])
    def ff(n):
        ans=0
        for x in range(n):
            while x:
                ans+=x%10
                x//=10
        return ans
    # print(f(a))
    print(ff(tmp))
    # elif n<100:
    #     print(a[1]*45+(a[1]+a[0]+a[1])*(a[0]+1)//2)
    # elif n<1000:
    #     print(a[2]*540+a[2]*(a[1]+a[2]+a[1])*(a[1]+1)//2+(a[1]+a[2]+a[1]+a[0]+a[1])*(a[0]+1)//2)
    return 0


solve(LOCAL)
子任务 #1
Wrong Answer
得分:0
测试点 #1
Wrong Answer
得分:0
用时:33 ms
内存:4216 KiB

输入文件(1.in

1
8

答案文件(1.out

36

用户输出

28

Special Judge 信息

Files user_out and answer differ

系统信息

Exited with return code 0
测试点 #2
Wrong Answer
得分:0
用时:31 ms
内存:4316 KiB

输入文件(2.in

10
1
6
1
8
3
4
6
9
8
6

答案文件(2.out

1
21
1
36
6
10
21
45
36
21

用户输出

0
15
0
28
3
6
15
36
28
15

Special Judge 信息

Files user_out and answer differ

系统信息

Exited with return code 0
测试点 #3
Time Limit Exceeded
得分:0
用时:1007 ms
内存:4356 KiB

输入文件(3.in

5000
4757
4980
4972
4759
4906
4561
4753
4946
4764
4971
4607
4616
4899
4567
4853
4890
4962
4862
4620

<24905 bytes omitted>

答案文件(3.out

72231
77001
76798
72280
75412
68491
72145
76200
72375
76776
69408
69543
75300
68608
74199
75066
7656
<29900 bytes omitted>
测试点 #4
Time Limit Exceeded
得分:0
用时:1049 ms
内存:4328 KiB

输入文件(4.in

5000
4617
4909
4775
4537
4948
4724
4947
4523
4927
4783
4653
4791
4704
4970
4886
4999
4940
4892
4611

<24905 bytes omitted>

答案文件(4.out

69561
75475
72618
68059
76249
71595
76224
67830
75808
72802
70191
72996
71265
76755
74961
77500
7607
<29900 bytes omitted>
测试点 #5
Time Limit Exceeded
得分:0
用时:1005 ms
内存:4320 KiB

输入文件(5.in

5000
4735
4595
4746
4560
4716
4716
4918
4990
4656
4809
4759
4613
4608
4750
4899
4517
4970
4553
4944

<24905 bytes omitted>

答案文件(5.out

71794
69198
72006
68475
71460
71460
75637
77257
70251
73365
72280
69495
69426
72091
75300
67743
7675
<29900 bytes omitted>
测试点 #6
Time Limit Exceeded
得分:0
用时:1042 ms
内存:4312 KiB

输入文件(6.in

5000
4924
4873
4529
4806
4802
4601
4906
4643
4688
4663
4695
4699
4532
4503
4520
4701
4895
4756
4981

<24905 bytes omitted>

答案文件(6.out

75745
74647
67935
73305
73239
69321
75412
70002
70938
70390
71094
71200
67974
67542
67791
71223
7518
<29900 bytes omitted>
测试点 #7
Time Limit Exceeded
得分:0
用时:1052 ms
内存:4324 KiB

输入文件(7.in

10000
199818
199603
199854
199533
199525
199711
199660
199974
199532
199840
199748
199523
199930
199
<69906 bytes omitted>

答案文件(7.out

4593303
4585906
4594545
4583499
4583251
4589560
4587751
4598970
4583469
4594051
4590786
4583190
4597
<79900 bytes omitted>
测试点 #8
Time Limit Exceeded
得分:0
用时:1047 ms
内存:4352 KiB

输入文件(8.in

10000
199547
199674
199831
199997
199807
199967
199574
199707
199834
199811
199644
199817
199775
199
<69906 bytes omitted>

答案文件(8.out

4583952
4588245
4593736
4599909
4592944
4598700
4584870
4589436
4593835
4593072
4587195
4593267
4591
<79900 bytes omitted>
测试点 #9
Time Limit Exceeded
得分:0
用时:1003 ms
内存:4320 KiB

输入文件(9.in

10000
199599
199630
199637
199657
199536
199861
199917
199605
199844
199573
199661
199653
199713
199
<69906 bytes omitted>

答案文件(9.out

4585800
4586743
4586967
4587643
4583595
4594807
4596885
4585965
4594185
4584835
4587783
4587501
4589
<79900 bytes omitted>
测试点 #10
Time Limit Exceeded
得分:0
用时:1004 ms
内存:4320 KiB

输入文件(10.in

10000
199855
199529
199769
199507
199775
199909
199718
199930
199672
199707
199816
199890
199712
199
<69906 bytes omitted>

答案文件(10.out

4594582
4583385
4591545
4582720
4591758
4596625
4589784
4597336
4588174
4589436
4593232
4595931
4589
<79900 bytes omitted>