https://codeforc.es/contest/1195/problem/D1

给\(n\)个等长的十进制数串,定义操作\(f(x,y)\)的结果是“从\(y\)的末尾开始一个一个交替放得到的数”,求\(\sum\limits_{i=1}^{n}\sum\limits_{j=1}^{n}f(a_i,a_j)\)

很明显每个第\(k\)位(从1开始)都会恰好在\(2k\)和\(2k-1\)位各贡献\(n\)次。预处理出\(pow10\)然后暴力就可以了。

#include<bits/stdc++.h>
using namespace std;
typedef long long ll; ll a[100005]; const ll mod=998244353; ll ans; ll calc(ll x){
ll res=0;
ll base=1;
while(x){
ll r=x%10ll;
res=(res+base*11ll%mod*r%mod)%mod;
x/=10;
base=(base*100ll)%mod;
}
//cout<<res<<endl;
return res%mod;
} int main() {
#ifdef Yinku
freopen("Yinku.in", "r", stdin);
//freopen("Yinku.out", "w", stdout);
#endif // Yinku
int n;
while(~scanf("%d", &n)) {
for(int i=1;i<=n;++i){
scanf("%lld",&a[i]);
}
ans=0;
for(int i=1;i<=n;i++){
ans=(ans+calc(a[i]))%mod;
}
printf("%lld\n",ans*n%mod);
}
}

Codeforces - 1195D1 - Submarine in the Rybinsk Sea (easy edition) - 水题的更多相关文章

  1. Codeforces Round #574 (Div. 2) D1. Submarine in the Rybinsk Sea (easy edition) 【计算贡献】

    一.题目 D1. Submarine in the Rybinsk Sea (easy edition) 二.分析 简单版本的话,因为给定的a的长度都是定的,那么我们就无需去考虑其他的,只用计算ai的 ...

  2. Codeforces - 1195D2 - Submarine in the Rybinsk Sea (hard edition) - 组合数学

    https://codeforc.es/problemset/problem/1195/D2 很明显可以看出,任意一个长度为\(l_1\)的数串\(s_1\)和任意一个长度为\(l_2\)的数串\(s ...

  3. Codeforces Round #574 (Div. 2) D2. Submarine in the Rybinsk Sea (hard edition) 【计算贡献】

    一.题目 D2. Submarine in the Rybinsk Sea (hard edition) 二.分析 相比于简单版本,它的复杂地方在于对于不同长度,可能对每个点的贡献可能是有差异的. 但 ...

  4. Codeforces 148D 一袋老鼠 Bag of mice | 概率DP 水题

    除非特别忙,我接下来会尽可能翻译我做的每道CF题的题面! Codeforces 148D 一袋老鼠 Bag of mice | 概率DP 水题 题面 胡小兔和司公子都认为对方是垃圾. 为了决出谁才是垃 ...

  5. Codeforces Testing Round #8 B. Sheldon and Ice Pieces 水题

    题目链接:http://codeforces.com/problemset/problem/328/B 水题~ #include <cstdio> #include <cstdlib ...

  6. Codeforces Round #290 (Div. 2) A. Fox And Snake 水题

    A. Fox And Snake 题目连接: http://codeforces.com/contest/510/problem/A Description Fox Ciel starts to le ...

  7. Codeforces Round #322 (Div. 2) A. Vasya the Hipster 水题

    A. Vasya the Hipster Time Limit: 1 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/contest/581/p ...

  8. Codeforces Round #373 (Div. 2) B. Anatoly and Cockroaches 水题

    B. Anatoly and Cockroaches 题目连接: http://codeforces.com/contest/719/problem/B Description Anatoly liv ...

  9. Codeforces Round #368 (Div. 2) A. Brain's Photos 水题

    A. Brain's Photos 题目连接: http://www.codeforces.com/contest/707/problem/A Description Small, but very ...

随机推荐

  1. R语言——ggplot2补充知识点

    案例 ggplot(head(age_data,10),aes(x=reorder(Country,age_median),y=age_median))+ geom_bar(aes(fill=Coun ...

  2. 脚本_统计 Linux 进程相关数量信息

    #!bin/bash#作者:liusingbon#功能:统计 Linux 进程相关数量信息,running(运行的进程),sleeping(睡眠中的进程),stoped(停止的进程),zombie(僵 ...

  3. postgresql windows 服务启动失败

    1命令行 启动服务 pg_ctl -D "C:\Program Files\PostgreSQL\9.1\data" start 2 查看状态 pg_ctl -D "C: ...

  4. c# 匿名委托

    using System; namespace AnonymousMethod { delegate void ArithmeticOperation(double operand1, double ...

  5. js格式化数字或者小数,加入千分符(此次为”,“)

    function npChangeNum(num) { var tag = (num || 0).toString().split("."); tag[0] = tag[0].re ...

  6. python——解释型语言

    编程语言分三大类   :  低级语言  .  汇编语言 .   高级语言. 现代计算机都是基于  图灵机模型 制造的.  因此计算机的内部只能接受二进制数据.而用二进制代码  0  1  描述的指令叫 ...

  7. Mac Pro 安装win10记录(不用优盘版)

    用启动转换助理 就可以了提前下好win10 iso系统镜像文件,然后Mac会自动安装.然后一直下一步就可以了. 我这次装好之后无法连接网络,发现是因为win网卡驱动没有,所以回到Mac系统下 把需要的 ...

  8. MJ瀑布流学习笔记

    1. 如果系统自带的布局的话,是这样: //系统自带的UICollectionViewFlowLayout 而不是UICollectionViewLayout UICollectionViewFlow ...

  9. Incorporating ASP.NET MVC and SQL Server Reporting Services, Part 2

    In the last issue, I introduced you to the basics of incorporating SQL Server Reporting Services int ...

  10. 关于Spring中BeanUtils的一次使用问题记录

    1.问题描述:今天在进行前后端联调的时候,发现商品图片不能正常显示: 2.排查过程:查看浏览器控制台,发现调用接口返回的数据关于图片的字段未返回数据:      然后,又跑了一下Dao层的单元测试,从 ...