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. php WebService应用

    <?php header ( "Content-Type: text/html; charset=gb2312" ); /* * 指定WebService路径并初始化一个We ...

  2. 10.Linux-CentOS系统重启之后Xshell无法SSH连接(云环境)

    问题:云环境下CentOS系统断电或强制关机,再开机出现问题:Entering emergency mode. Exit the shell to continue. Generating " ...

  3. 网络拓扑_配置VLAN虚拟局域网

    目的: 1.创建VLAN10,VALN20,VLAN30; 2.将端口加入VLAN 3.查看VLAN信息 拓扑图: 步骤: 1.在三层交换机中创建VLAN10,VLAN20,VLAN30 <Hu ...

  4. BZOJ 1911 特别行动队 (斜率优化)

    $ BZOJ~1911~*~ $ 特别行动队: (斜率优化) $ solution: $ 感觉这道题目还是比较常规的,首先我们很容易想到DP,因为题目里面说了选出的人都是连续的,这意味着我们可以从前往 ...

  5. python数据库操作-mysql数据库

    一:连接 1:本地连接 mysql -u用户名 -p密码 2:连接远程服务器 mysql -u用户名 -p密码 -hip地址 -P端口号     线下修改远程服务端上部署的mysql服务器 二:创建数 ...

  6. easyui加载json菜单的相关代码

    /** * 取菜单数据 */ $(function getmenujson() { $.ajax({ type: "GET", cache: false, url: "/ ...

  7. Python---基础---list(列表)

    2019-05-20 一. # append()  向列表末尾追加新元素   返回值Nonelist1 = [1,2,3,4,5]print(id(list1))list1.append(6)prin ...

  8. OC + RAC (十) 常用宏

    . RAC(TARGET, [KEYPATH, [NIL_VALUE]]) :用于给某个对象的某个属性绑定. // 只要文本框文字改变,就会修改label的文字 RAC(self.labelView, ...

  9. PHP Timer 页面运行时间监测类

    转至:http://blog.csdn.net/fdipzone/article/details/20160567 php Timer 页面运行时间监测类,可按不同key监测不同的运行时间 Timer ...

  10. CF1182 D Complete Mirror——思路

    题目:http://codeforces.com/contest/1182/problem/D 很好的思路是从度数为1的点和直径来入手. 找一条直径.看看直径的两个端点是否合法. 如果都不合法,那么根 ...