Codeforces Round #449 (Div. 2)
lxl大哥的珂朵莉场,被打爆了啊,掉蓝
B. Chtholly's request
题意
偶数数字回文串,求K个偶数数字回文串的和%p
分析
比赛的时候打表的打不出来啊,然后就晕了,脑子石乐志了
正解:找规律,观察可得,枚举前一半就可以了23333
#include <bits/stdc++.h> #define ll long long #define rep(i,a,b) for(int i=a;i<=b;i++) #define pii pair<int,int> #define mp make_pair using namespace std; #define fi first #define se second const int maxn = 2e5+10; int k,p; string s; long long answer(int x) { ll sum=x; while(x) { sum=sum*10+x%10; x/=10; sum%=p; } return sum%p; } int main() { scanf("%d%d", &k, &p); ll ans=0; for(int i = 1; i <= k; i++) { ans=(ans+answer(i))%p; } printf("%I64d\n", ans); return 0; }
C. Nephren gives a riddle
毒瘤题
要么优秀要么生锈