Chinese Valentine‘s Day

本文介绍了一个有趣的算法题目,背景设定在情人节前夕,主人公需要通过解决一个数学问题来找到被藏起来的电脑。题目要求求出一系列数字中所有可能子串数字的总和,并取模9982443553。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

Chinese Valentine's Day

 1000ms  262144K

描述:

Recently, God Liu has been so absorbed in the Pac-Man game that he has even neglected his young fans.So before Chinese valentine's day,in order to have time for him to accompany the girls, while God Liu went to the bathroom, Lao Zhao hid his computer, and told him that computer had been hidden near the date place.But Lao Zhao can't tell him where the computer has been hidden.

Lao Zhao tell God Liu N numbers, the answer is the sum of all the numbers that have appeared in n numbers(mod 9982443553).For example, in 123 there are 1,2,3,12,23,123。

Gao Liu are so excited,he decides to pick up the computer after the date night.But he is too busy,sou he ask you to help him。Do you know the answer?

输入:

In the first line there is an positive integer N(1<=N<=1000),which means there are N numbers.

The next N line,each line is contains one number.

The digit sum of all numbers does not exceed 1000000

输出:

One integer after mod 99824435539982443553.(An occurrence in a number is defined as the number of substrings, and repeated occurrences are counted only once)

样例输入:

3
1
12
123

样例输出:

164

Of all the numbers that have ever appeared 1,2,3,12,23,123,so the sum is 164.

翻译:

中国的情人节

最近,刘神如此专注于吃豆人游戏,以至于他甚至忽视了他的年轻粉丝。所以在中国的情人节之前,为了有时间陪女孩们,当刘天爷去洗手间时,老赵把电脑藏了起来,告诉他电脑藏在约会地点附近。但老赵无法告诉他电脑藏在哪里。

老赵告诉神刘N个数字,答案是N个数字(mod 9982443553)中出现的所有数字的总和。例如,在123中有1,2,3,12,23,123

高刘非常激动,他决定在约会之的夜晚结束后拿起电脑。但是他太忙了,所以他请求你帮助他。你知道答案吗

输入:

在第一行输入一个正整数 N(1<=N<=1000)数字中的出现次数定义为子字符串的数量,重复出现的次数仅统计一次

样例输入:

3
1
12
123

样例输出:

164

在数字出现所有形式中有 1,2,3,12,23,123,所以总和为164.

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值