• 欢迎光临~

# Educational Codeforces Round 133 (Rated for Div. 2) ABD

## A. 2-3 Moves

0只用0次，1只用1次

t = n / 3；

```void solve()
{
//    cin>>n>>m;
cin>>n;
int i = n;
if(i == 0) {
cout<<0<<endl; rt
} else if(abs(i) == 2 || abs(i) == 3) {
cout<<1<<endl;rt
} else if(abs(i) == 1) {
cout<<2<<endl;rt;
}

n = abs(n);
int t = n / 3;
if(n % 3 == 1) {
cout<<t + 1<<endl;
} else if(n % 3 == 0){
cout<<t<<endl;
} else {
cout<<t + 1<<endl;
}
}```

## B. Permutation Chain

```//#define int ll
const int N = 1e5+10;
int n,m;
int a[N];
void solve()
{
//
cin>>n;
int j = 1;
fo(i,1,n) a[i] = i;
cout<<n<<endl;
fo(k,1,n) {
fo(i,1,n) {
cout<<a[i]<<' ';
} cout<<endl;
swap(a[j],a[n]);
j ++ ;
}

}```

## D. Chip Move

n根号n

ans[N] ，是从0 开始 经过各种数最终到达 i 的总方案数

sum[N]是这一轮，从0开始一直走到 i 的总方案数

```#define int ll
const int N = 2e5+10,mod = 998244353 ;
int n,m,k;
int f[N];
int ans[N];
int sum[N];
void solve()
{
//    cin>>n>>m;
cin>>n>>k;
f[0] = 1;
for(int i = 1;;i++) {
int t = k + i - 1;
fo(j,0,n) {
sum[j] = f[j];
if(j - t >= 0) sum[j] = (sum[j] + sum[j-t]) % mod;
}
fo(j,0,t-1) f[j] = 0;
fo(j,t,n) f[j] = sum[j-t];
fo(j,t,n) ans[j] = (ans[j] + f[j]) % mod;
if(1ll * i * (2 * k + i - 1) > n * 2) break;
}
fo(i,1,n) {
cout<<ans[i]<<" n"[i==n];
}
}```