D1. Submarine in the Rybinsk Sea (easy edition)

//看做的人挺多,也补一下吧,还没来得及看,哈哈
http://codeforces.com/contest/1195/problem/D1
在这里插入图片描述
在这里插入图片描述
//这题的题意很好理解,不说了,很简单,应该做快一点的
题解
对n个数的每一个数都有 这个数n10^(2i) 加上
这个数n10^(2i+1)//i是数的位数 加上就是结果
//交上就错,一样的数据,本地和交上返回的值不一样,我也是醉了,先放上下次慢慢改,溜了溜了
//这代码有点问题

#include <iostream>
#include <cstdio>
#include <algorithm>
#define ll long long
using namespace std;
const ll mod=998244353;
const int maxn=1e5+5;
ll a[maxn],b[maxn];
int n;
ll pow(ll a,ll b)
{
    ll res=1;
    while(b)
    {
        if(b&1)
        res=(a%mod)*(res%mod);
        a=(a*a)%mod;
        b=b/2;
    }
    return res%mod;
}

ll solve(ll a)
{
    ll res=0;
    ll ans=0;
    while(a)
    {
        ll temp=a%10;
        a/=10;
        res+=temp*pow(10,ans*2);
        res%=mod;
        res+=temp*pow(10,ans*2+1);
        ans++;
        res%=mod;
    }
    return res;
}

int main()
{
   cin>>n;
    for(int i=0;i<n;i++)
    {
       cin>>a[i];
    }
    ll ans=0;
    for(int i=0;i<n;i++)
    {
        ll temp;
        temp=(n*(solve(a[i])%mod))%mod;
        ans+=temp%mod;
    }
    ans%=mod;
    cout<<ans<<endl;
    return 0;
}

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值