ABC D求助,WA5个点
  • 板块学术版
  • 楼主SegmentTree_
  • 当前回复2
  • 已保存回复2
  • 发布时间2024/6/9 00:35
  • 上次更新2024/6/9 11:00:38
查看原帖
ABC D求助,WA5个点
716260
SegmentTree_楼主2024/6/9 00:35
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define makepair make_pair
#define fir first
#define sec second
const __int128 mod = 998244353; 
__int128 qpow(__int128 a, __int128 b){
	__int128 res = 1;
	while (b){
		if (b & 1) res = res * a % mod;
		a = a * a % mod;
		b /= 2;
	}
	return res;
}
ll n;
__int128 a;
void print(__int128 a){
	if (a <= 0) return;
	print(a / 10);
	cout << (ll)(a % 10);
}
__int128 glen(__int128 a){
	__int128 res = 0;
	while (a > 0){
		res = res + 1;
		a = a / 10;
	}
	return res;
}
signed main(){
	ios::sync_with_stdio(false), cin.tie(0), cout.tie(0);
	cin >> n;
	__int128 ans = n;
	a = n;
	__int128 len = glen(a);
	__int128 fm = (qpow(10, len) - 1 + mod) % mod;
	fm = qpow(fm, mod - 2);
	__int128 fz = (qpow(10, len * a) % mod - 1 + mod) % mod;
	ans = ans * fz % mod * fm % mod;
	print(ans);
	return 0;
}
2024/6/9 00:35
加载中...