Edu 151
A. Forbidden Integer
題意:
你有[1, k]內(nèi)除了
x
x
x的整數(shù),每個數(shù)可以拿多次,問
∑
=
n
\sum = n
∑=n是否可行并構(gòu)造
思路:
有1必能構(gòu)造,否則假如沒有1,假如有2, 3必定能構(gòu)造出大于等于2的所有數(shù),否則只有2的話只能構(gòu)造出偶數(shù)。
#include <bits/stdc++.h>
#define local
#define IOS ios::sync_with_stdio(false);cin.tie(0);
using namespace std;
using ll = long long;
using db = double;
using PII = pair<int, int>;
using PLI = pair<ll, int>;
template<class T>
ostream &operator<<(ostream &io, vector<T> a) {
io << "{";
for (auto I: a)io << I << " ";
io << "}";
return io;
}
template<class T>
ostream &operator<<(ostream &io, set<T> a) {
io << "{";
for (auto I: a)io << I << " ";
io << "}";
return io;
}
template<class K, class V>
ostream &operator<<(ostream &io, map<K, V> a) {
io << "(";
for (auto I: a)io << "{" << I.first << ":" << I.second << "}";
io << ")";
return io;
}
void debug_out() {
cerr << endl;
}
template<typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
cerr << ' ' << H;
debug_out(T...);
}
#ifdef local
#define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)
#else
#define debug(...) 1
#endif
#define all(x) x.begin(),x.end()
int main() {
IOS
int t;
cin >> t;
while (t--) {
int n, k, x;
cin >> n >> k >> x;
if (x == 1) {
if (k == 1) {
cout << "NO\n";
} else if (k == 2) {
if (n % 2 == 0) {
cout << "YES\n";
cout << n / 2 << '\n';
for (int i = 1; i <= n / 2; ++i) {
cout << 2 << " ";
}
cout << '\n';
} else {
cout << "NO\n";
}
} else {
if (n % 2 == 0) {
cout << "YES\n";
cout << n / 2 << '\n';
for (int i = 1; i <= n / 2; ++i) {
cout << 2 << " ";
}
cout << '\n';
} else {
if (n == 1) {
cout << "NO\n";
} else {
cout << "YES\n";
cout << 1 + (n - 3) / 2 << "\n";
cout << 3 << " ";
for (int i = 1; i <= (n - 3) / 2; ++i) {
cout << 2 << " ";
}
cout << '\n';
}
}
}
} else {
cout << "YES\n";
cout << n << '\n';
for (int i = 1; i <= n; ++i) {
cout << 1 << ' ';
}
cout << "\n";
}
}
return 0;
}
B. Come Together
題意:
棋盤上兩個點同時從C出發(fā)到A, B, 都走最短路徑,問最多重疊的格子數(shù)
思路:不難發(fā)現(xiàn),x, y軸對答案的貢獻是獨立的,考慮其中一維,假如在同方向才能有貢獻,分類討論即可。
#include <bits/stdc++.h>
#define local
#define IOS ios::sync_with_stdio(false);cin.tie(0);
using namespace std;
using ll = long long;
using db = double;
using PII = pair<int, int>;
using PLI = pair<ll, int>;
template<class T>
ostream &operator<<(ostream &io, vector<T> a) {
io << "{";
for (auto I: a)io << I << " ";
io << "}";
return io;
}
template<class T>
ostream &operator<<(ostream &io, set<T> a) {
io << "{";
for (auto I: a)io << I << " ";
io << "}";
return io;
}
template<class K, class V>
ostream &operator<<(ostream &io, map<K, V> a) {
io << "(";
for (auto I: a)io << "{" << I.first << ":" << I.second << "}";
io << ")";
return io;
}
void debug_out() {
cerr << endl;
}
template<typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
cerr << ' ' << H;
debug_out(T...);
}
#ifdef local
#define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)
#else
#define debug(...) 1
#endif
#define all(x) x.begin(),x.end()
int main() {
IOS
int t;
cin >> t;
while (t--) {
int xa, ya, xb, yb, xc, yc;
cin >> xa >> ya >> xb >> yb >> xc >> yc;
int x1 = xb - xa, x2 = xc - xa, y1 = yb - ya, y2 = yc - ya;
int ans = 1;
if ((ll)x1 * x2 >= 0) {
if (abs(x1) > abs(x2))
swap(x1, x2);
ans += abs(x1);
}
if ((ll)y1 * y2 >= 0) {
if (abs(y1) > abs(y2))
swap(y1, y2);
ans += abs(y1);
}
cout << ans << '\n';
}
return 0;
}
C. Strong Password
題意:
給定字符串
s
s
s,問是否存在長度為
m
m
m, 每個密碼的第
i
i
i位數(shù)字在
[
l
i
,
r
i
]
[l_i, r_i]
[li?,ri?]之間,且不為
s
s
s的子序列的字符串。
思路:
每個密碼在
s
s
s中都是獨立的,顯然我們要讓它不為子序列,貪心的考慮在
i
i
i這個位置選擇最靠后的字母,建出子序列自動機模擬即可。
#include <bits/stdc++.h>
#define local
#define IOS ios::sync_with_stdio(false);cin.tie(0);
using namespace std;
using ll = long long;
using db = double;
using PII = pair<int, int>;
using PLI = pair<ll, int>;
template<class T>
ostream &operator<<(ostream &io, vector<T> a) {
io << "{";
for (auto I: a)io << I << " ";
io << "}";
return io;
}
template<class T>
ostream &operator<<(ostream &io, set<T> a) {
io << "{";
for (auto I: a)io << I << " ";
io << "}";
return io;
}
template<class K, class V>
ostream &operator<<(ostream &io, map<K, V> a) {
io << "(";
for (auto I: a)io << "{" << I.first << ":" << I.second << "}";
io << ")";
return io;
}
void debug_out() {
cerr << endl;
}
template<typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
cerr << ' ' << H;
debug_out(T...);
}
#ifdef local
#define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)
#else
#define debug(...) 1
#endif
#define all(x) x.begin(),x.end()
int main() {
IOS
int t;
cin >> t;
while (t--) {
string s;
cin >> s;
int n = s.length();
s = ' ' + s;
int m;
cin >> m;
string l, r;
cin >> l >> r;
l = ' ' + l;
r = ' ' + r;
vector<vector<int>> nxt(n + 1, vector<int>(10, 0));
for (int i = 0; i < 10; ++i)
nxt[n][i] = n + 1;
for (int i = n - 1; i >= 0; --i) {
for (int j = 0; j < 10; ++j) {
if (s[i + 1] - '0' == j) {
nxt[i][j] = i + 1;
} else {
nxt[i][j] = nxt[i + 1][j];
}
}
}
int ps = 0;
bool f = 0;
for (int i = 1; i <= m; ++i) {
int mx = 0;
if (f)
break;
for (int j = l[i]; j <= r[i]; ++j) {
mx = max(mx, nxt[ps][j - '0']);
if (mx >= n + 1) {
f = 1;
break;
}
}
ps = mx;
}
if (ps >= n + 1)
f = 1;
cout << (f ? "YES\n" : "NO\n");
}
return 0;
}
D. Rating System
題意:
給出長度為
n
n
n的序列
a
{a}
a, 有一個數(shù)
s
s
s, 第
i
i
i次操作會使
s
s
s加上
a
i
a_i
ai?, 選擇一個值
k
k
k, 當
s
>
=
k
s >= k
s>=k的時候,
s
s
s不會再小于
k
k
k, 求
n
n
n次操作后使得
s
s
s最大的整數(shù)
k
k
k, 輸出任意一種
思路:
原函數(shù)圖大體上是折線型的,不難想到答案最大的時候,
k
k
k一定是
∑
a
i
(
下降時候取到的
s
u
m
)
\sum a_i(下降時候取到的sum)
∑ai?(下降時候取到的sum)。s的變化分為三個階段:到達
k
k
k, 經(jīng)過一些操作下降到
k
k
k,再也不會收到
k
k
k的限制??紤]枚舉第三階段的起點
i
i
i, 那么答案就是k + sum[n] - sum[i - 1], 維護前綴最大sum更新
k
k
k即可。
#include <bits/stdc++.h>
#define local
#define IOS ios::sync_with_stdio(false);cin.tie(0);
using namespace std;
using ll = long long;
using db = double;
using PII = pair<int, int>;
using PLI = pair<ll, int>;
template<class T>
ostream &operator<<(ostream &io, vector<T> a) {
io << "{";
for (auto I: a)io << I << " ";
io << "}";
return io;
}
template<class T>
ostream &operator<<(ostream &io, set<T> a) {
io << "{";
for (auto I: a)io << I << " ";
io << "}";
return io;
}
template<class K, class V>
ostream &operator<<(ostream &io, map<K, V> a) {
io << "(";
for (auto I: a)io << "{" << I.first << ":" << I.second << "}";
io << ")";
return io;
}
void debug_out() {
cerr << endl;
}
template<typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
cerr << ' ' << H;
debug_out(T...);
}
#ifdef local
#define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)
#else
#define debug(...) 1
#endif
#define all(x) x.begin(),x.end()
int main() {
IOS
int t;
cin >> t;
while(t--) {
int n;
cin >> n;
vector<int> a(n + 1, 0);
for (int i = 1; i <= n; ++i)
cin >> a[i];
vector<ll> sum(n + 1, 0);
sum[1] = a[1];
for (int i = 2; i <= n; ++i) {
sum[i] = sum[i - 1] + a[i];
}
ll mx = 0, ans = 0, ans2 = 0;
for (int i = 1; i <= n; ++i) {
ll now = sum[n] - sum[i - 1] + mx;
if (now > ans) {
ans2 = mx;
ans = now;
}
mx = max(mx, sum[i]);
}
if (mx > ans) {
ans2 = mx;
}
cout << ans2 << "\n";
}
return 0;
}
E. Boxes and Balls
題意:
給定
n
n
n個盒子,其中一些盒子有球,保證不可能全滿或者全空。每次可以移動球到相鄰的空盒子,問恰好移動
k
k
k次的情況下球體排列狀況有多少可能性。
思路:
- 最后的排列中,球體的相對位置不會改變
- 容易想到一個 d p dp dp, d p [ i ] [ j ] [ k ] dp[i][j][k] dp[i][j][k]表示當前枚舉到第 i i i個位置,放了 j j j個球,移動次數(shù)之和為 k k k的方案。時間復雜度是 O ( n 2 k ) O(n^2k) O(n2k)對于相對位置移動次數(shù)之和的統(tǒng)計,套路的轉(zhuǎn)化為位置間隔被經(jīng)過次數(shù)的統(tǒng)計之和。對于i后面的間隔,前面的所有存在的球都會對其有貢獻,貢獻為 ∣ s u m i ? s u m i ′ ∣ |sum_i - sum'_i| ∣sumi??sumi′?∣, s u m i 為移動前的 ∑ a i sum_i為移動前的\sum a_i sumi?為移動前的∑ai?, s u m i ′ sum'_i sumi′?為移動后的。又由于題目要求每個間隔的貢獻 ∑ ∣ s u m i ? s u m i ′ ∣ ≤ k \sum |sum_i - sum'_i| \leq k ∑∣sumi??sumi′?∣≤k且 s u m i ′ ? s u m i ? 1 ′ ≤ 1 sum'_i - sum'_{i - 1} \leq 1 sumi′??sumi?1′?≤1, 考慮前面所有位置對前綴 i i i所有的間隔的貢獻,最優(yōu)情況是個等差數(shù)列,所以對于每個 i i i, ∣ s u m i ? s u m i ′ ∣ < = s q r t ( k ) |sum_i - sum'_i| <= sqrt(k) ∣sumi??sumi′?∣<=sqrt(k),改變 d p dp dp定義, d p [ i ] [ j ] [ k ] dp[i][j][k] dp[i][j][k]表示當前枚舉到第 i i i個盒子,新排列比原排列多 j j j個球,移動次數(shù)為 k k k的方案數(shù),轉(zhuǎn)移的時候枚舉下一位放不放即可。
#include <bits/stdc++.h>
#define local
#define IOS ios::sync_with_stdio(false);cin.tie(0);
using namespace std;
using ll = long long;
using db = double;
using PII = pair<int, int>;
using PLI = pair<ll, int>;
template<class T>
ostream &operator<<(ostream &io, vector<T> a) {
io << "{";
for (auto I: a)io << I << " ";
io << "}";
return io;
}
template<class T>
ostream &operator<<(ostream &io, set<T> a) {
io << "{";
for (auto I: a)io << I << " ";
io << "}";
return io;
}
template<class K, class V>
ostream &operator<<(ostream &io, map<K, V> a) {
io << "(";
for (auto I: a)io << "{" << I.first << ":" << I.second << "}";
io << ")";
return io;
}
void debug_out() {
cerr << endl;
}
template<typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
cerr << ' ' << H;
debug_out(T...);
}
#ifdef local
#define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)
#else
#define debug(...) 1
#endif
#define all(x) x.begin(),x.end()
const int maxn = 1505;
const int mod = 1e9 + 7;
int f[2][140][maxn];
void Add(int &x, int y) {
x += y;
if (x >= mod)
x -= mod;
}
int a[maxn];
int main() {
IOS
int n, k;
cin >> n >> k;
for (int i = 1; i <= n; ++i) {
cin >> a[i];
}
int del = 57;
int op = 0;
f[op][0 + del][0] = 1;
for (int i = 0; i < n; ++i) {
for (int j = max(-del, -i); j <= min(i, del); ++j) {
for (int v = 0; v <= k; ++v) {
if (!f[op][j + del][v])
continue;
for (auto q : {0, 1}) {
int nx1 = j + q - a[i + 1];
int nx2 = v + abs(nx1);
if (nx2 > k)
continue;
Add(f[op ^ 1][nx1 + del][nx2], f[op][j + del][v]);
}
}
}
for (int j = max(-del, -(i + 1)); j <= min(i + 1, del); ++j) {
for (int v = 0; v <= k; ++v) {
f[op][j + del][v] = 0;
}
}
op ^= 1;
}
int ans = 0;
for (int i = k; i >= 0; i -= 2) {
Add(ans, f[op][0 + del][i]);
}
cout << ans;
return 0;
}
F.Swimmers in the Pool
題意:
游泳道
n
n
n個人來回游,速度
v
i
v_i
vi?, 泳道長
l
l
l, 總共游
t
t
t時刻,問有多少個時刻至少有2個人碰到。
思路:
對于
i
i
i和
j
j
j兩個人,相遇的時刻
t
=
2
k
l
∣
v
i
?
v
j
∣
t = \frac{2kl}{|v_i - v_j|}
t=∣vi??vj?∣2kl?或者
t
=
2
k
l
v
i
+
v
j
t = \frac{2kl}{v_i + v_j}
t=vi?+vj?2kl?, 對于
∣
v
i
?
v
j
∣
|v_i - v_j|
∣vi??vj?∣和
v
i
+
v
j
v_i + v_j
vi?+vj?是否存在,卷積即可?,F(xiàn)在問題變成統(tǒng)計
a
=
2
k
l
b
a = \frac{2kl}
a=b2kl?, 化簡即統(tǒng)計
a
=
k
b
a = \frac{k}
a=bk?,
a
屬于
[
0
,
t
2
l
]
a屬于[0, \frac{t}{2l}]
a屬于[0,2lt?], 對于
a
a
a的統(tǒng)計是唯一的,考慮枚舉所有滿足條件的
b
b
b, 對于
g
c
d
(
k
,
b
)
=
1
gcd(k, b) = 1
gcd(k,b)=1的答案必定是唯一的,
∑
k
=
1
t
b
2
l
[
g
c
d
(
k
,
b
)
=
1
]
=
∑
d
∣
b
m
u
[
b
]
(
t
b
)
/
(
2
l
)
/
d
\sum\limits_{k = 1} ^ {{\frac{tb}{2l}}}[gcd(k, b) = 1] = \sum_{d|b} mu[b] (tb) / (2l) / d
k=1∑2ltb??[gcd(k,b)=1]=∑d∣b?mu[b](tb)/(2l)/d, 那對于不互質(zhì)的數(shù)要如何計算呢,不難發(fā)現(xiàn)假如不互質(zhì),設
g
c
d
(
k
,
b
)
gcd(k, b)
gcd(k,b) = d, 其必定在
b
b
b的某個約數(shù)
b
d
\fracn5n3t3z
db?的時候被完全互質(zhì)統(tǒng)計到,倒序枚舉
b
b
b并枚舉約數(shù)更新即可。文章來源:http://www.zghlxwxcb.cn/news/detail-531510.html
事實上我們并不需要莫反,其本質(zhì)只是一種容斥,同樣定義 f i f_i fi?表示 g c d ( k , b ) = 1 gcd(k, b) = 1 gcd(k,b)=1時, b = i b = i b=i的合法方案數(shù), 容斥總方案數(shù) ? g c d ( k , b ) = 2 / 3 / 4.... 容斥總方案數(shù) - gcd(k, b) = 2/3/4.... 容斥總方案數(shù)?gcd(k,b)=2/3/4....,所以 f i = ( t i ) / ( 2 l ) ? ∑ j ∣ i f j f_i = (ti) / (2l) - \sum_{j | i} f_j fi?=(ti)/(2l)?∑j∣i?fj?, 每個 g c d ( k , b ) ! = 1 gcd(k, b) != 1 gcd(k,b)!=1的答案會被 b b b的某個約數(shù)d在 g c d ( k ′ , d ) gcd(k', d) gcd(k′,d)的時候更新, 所以最后的答案就是 ∑ f j [ j ∣ b ] \sum f_j [j | b] ∑fj?[j∣b]文章來源地址http://www.zghlxwxcb.cn/news/detail-531510.html
#include<bits/stdc++.h>
#define IOS ios::sync_with_stdio(false); cin.tie(0);
using namespace std;
using ull=unsigned long long;
using ll=long long;
const int mod= 998244353,G=3;//??
const int maxn=2e5+5;
template<typename T>
void read(T &f){
f=0;T fu=1;char c=getchar();
while(c<'0'||c>'9'){ if(c=='-')fu=-1;c=getchar();}
while(c>='0'&&c<='9'){ f=(f<<3)+(f<<1)+(c&15);c=getchar();}
f*=fu;
}
template<typename T>
void print(T x){
if(x<0)putchar('-'),x=-x;
if(x<10)putchar(x+48);
else print(x/10),putchar(x%10+48);
}
template <typename T>
void print(T x, char t) {
print(x); putchar(t);
}
inline int Add(int x,int y){
x+=y;
if(x>=mod)x-=mod;
return x;
}
inline int Sub(int x,int y){
x-=y;
if(x<0)x+=mod;
return x;
}
inline ll mul(ll x,ll y){ return 1ll*x*y%mod;}
ll mypow(int a,int b){
int ans=1;
while(b){
if(b&1)ans=mul(ans,a);
a=mul(a,a);
b>>=1;
}
return ans;
}
namespace Poly{
typedef vector<ll>poly;
poly roots,rev;
void getRevRoot(int base){
int lim=1<<base;
if((int)roots.size()==lim)return;
roots.resize(lim);rev.resize(lim);
for(int i=1;i<lim;++i)rev[i]=(rev[i>>1]>>1)|((i&1)<<(base-1));
for(int mid=1;mid<lim;mid<<=1){
int wn=mypow(G,(mod-1)/(mid<<1));
roots[mid]=1;
for(int i=1;i<mid;++i)roots[mid+i]=mul(roots[mid+i-1],wn);
}
}
void ntt(poly&a,int base){
int lim=1<<base;
for(int i=0;i<lim;++i)if(i<rev[i])swap(a[i],a[rev[i]]);
for(int mid=1;mid<lim;mid<<=1){
for(int i=0;i<lim;i+=(mid<<1)){
for(int j=0;j<mid;++j){
int x=a[i+j],y=mul(a[i+j+mid],roots[j+mid]);
a[i+j]=Add(x,y);
a[i+j+mid]=Sub(x,y);
}
}
}
}
poly operator*(poly a,poly b){
int lim=(int)a.size()+(int)b.size()-1,base=0;
while((1<<base)<lim)++base;
a.resize(1<<base);b.resize(1<<base);
getRevRoot(base);
ntt(a,base);ntt(b,base);
for(int i=0;i<(1<<base);++i)a[i]=mul(a[i],b[i]);
ntt(a,base);
reverse(a.begin()+1,a.end());
a.resize(lim);
int inv=mypow(1<<base,mod-2);
for(int i=0;i<lim;++i)a[i]=mul(a[i],inv);
return a;
}
poly polyInv(poly f,int base){
int lim=1<<base;
f.resize(lim);
if(lim==1){
poly ans(1,mypow(f[0],mod-2));
return ans;
}
poly g(1<<base,0),g0=polyInv(f,base-1),tmp=g0*g0*f;
for(int i=0;i<(1<<(base-1));++i)g[i]=Add(g0[i],g0[i]);
for(int i=0;i<(1<<base);++i)g[i]=Sub(g[i],tmp[i]);
return g;
}
poly polyInv(poly f){
int lim=(int)f.size(),base=0;
while((1<<base)<lim)++base;
f=polyInv(f,base);f.resize(lim);
return f;
}
poly operator+(const poly&a,const poly&b){
poly c=a;
c.resize(max(a.size(),b.size()));
int lim=(int)b.size();
for(int i=0;i<lim;++i)c[i]=Add(c[i],b[i]);
return c;
}
poly operator-(const poly&a,const poly&b){
poly c=a;
c.resize(max(a.size(),b.size()));
int lim=(int)b.size();
for(int i=0;i<lim;++i)c[i]=Sub(c[i],b[i]);
return c;
}
poly operator*(const int&b,const poly&a){
poly c=a;
int lim=(int)a.size();
for(int i=0;i<lim;++i)c[i]=mul(b,c[i]);
return c;
}
}
using namespace Poly;
const int del = 2e5;
const int M = 4e5 + 5;
int v[maxn * 2 + 5], mu[maxn * 2 + 5];
bool is[maxn << 1];
vector<int> pr;
ll dp[maxn << 1];
void init() {
mu[1] = 1;
for (int i = 2; i < 2 * maxn; ++i) {
if (!v[i])
pr.emplace_back(i), mu[i] = -1;
for (int j = 0; j < pr.size() && i * pr[j] < 2 * maxn; ++j) {
v[i * pr[j]] = 1;
if (i % pr[j] == 0) {
mu[i * pr[j]] = 0;
break;
}
mu[i * pr[j]] = -mu[i];
}
}
}
const int P = 1e9 + 7;
vector<int> fac[maxn << 1];
ll mxk[maxn << 1];
int main() {
IOS
init();
int l, t, n;
cin >> l >> t >> n;
int mx = 0;
for (int i = 1; i <= n; ++i) {
cin >> v[i];
mx = max(mx, v[i]);
}
poly a(mx + 1, 0), b(del + 1, 0);
for (int i = 1; i <= n; ++i) {
a[v[i]]++, b[del - v[i]]++;
}
poly A = a * a, B = a * b;
for (int i = 1; i <= n; ++i) {
A[2 * v[i]]--;
}
for (int i = 1; i <= 2 * mx; ++i) {
if (A[i]) {
is[i] = 1;
}
}
for (int i = 1; i <= mx; ++i) {
if (B[i + del])
is[i] = 1;
}
for (int i = 2 * mx; i >= 1; --i)
for (int j = i; j <= 2 * mx; j += i)
is[i] |= is[j];
// fac[j].emplace_back(i);
ll ans = 0;
// for (int i = 2 * mx; i; --i) {
// if (is[i]) {
// mxk[i] = ((ll) t * i) / (2 * l);
// }
// for (auto u : fac[i]) {
// ans = (ans + mu[u] * (mxk[i] / u) % P) % P;
// if (ans >= P)
// ans -= P;
// if (ans < 0)
// ans += P;
// mxk[i / u] = max(mxk[i / u], mxk[i] / u);
// }
// }
for (int i = 1; i <= 2 * mx; ++i) {
dp[i] = (dp[i] + ((ll) t * i) / (2 * l)) % P;
if (is[i])
ans = (ans + dp[i]) % P;
for (int j = 2 * i; j <= 2 * mx; j += i) {
dp[j] = (dp[j] - dp[i] + P) % P;
}
}
cout << ans;
return 0;
}
到了這里,關(guān)于Educational Codeforces Round 151 (Rated for Div. 2)的文章就介紹完了。如果您還想了解更多內(nèi)容,請在右上角搜索TOY模板網(wǎng)以前的文章或繼續(xù)瀏覽下面的相關(guān)文章,希望大家以后多多支持TOY模板網(wǎng)!