Educational Codeforces Round 84 (Rated for Div. 2)E(组合数学)

 1 #define HAVE_STRUCT_TIMESPEC
 2 #include<bits/stdc++.h>
 3 using namespace std;
 4 const int mod = 998244353;
 5 long long p[200007];
 6 int main(){
 7     ios::sync_with_stdio(false);
 8     cin.tie(NULL);
 9     cout.tie(NULL);
10     int n;
11     cin>>n;
12     p[0]=1;
13     for(int i=1;i<=n;++i)
14         p[i]=p[i-1]*10%mod;
15     for(int i=1;i<n;++i){
16         long long ans=2*10*9*p[n-i-1]%mod;//连续i个数字出现在数字串的两端,以一个不同的数字分隔开,剩下随便选
17         if(i<=n-2)//可以出现在数字串的中间
18             ans=(ans+10*(n-i-1)*9*9*p[n-i-2])%mod;//n-i+1种位置,每种位置10种数字,两端以不同的数字分隔开,各有九种,剩下的数字有10^(n-i-2)种情况随便选
19         cout<<ans<<" ";
20     }
21     cout<<10;//n个数字全部相同
22     return 0;
23 }

原文地址:https://www.cnblogs.com/ldudxy/p/12594641.html

时间: 2024-11-06 07:31:57

Educational Codeforces Round 84 (Rated for Div. 2)E(组合数学)的相关文章

C - Game with Chips.Educational Codeforces Round 84 (Rated for Div. 2)

http://codeforces.com/contest/1327/problem/C 题意 给你一个图和一堆点,然后问你这一堆点和一堆目标点怎么才能到达这些目标点至少一次. 做法 其实题目已经给你提示了,上面说移动次数不大于2nm. 其实在2nm内就能把图上所有位置遍历一遍. 简单来说就是不管你脑洞开的有多大,没有用.该暴力还是得暴力. 先把最右上角的点移动到左下角,再按照s型移动到原始位置 就能保证所有点都经历过这个图上别的所有点了. 代码 #include <iostream> usi

Educational Codeforces Round 84 (Rated for Div. 2) C. Game with Chips(思维题)

Petya has a rectangular Board of size n×mn×m . Initially, kk chips are placed on the board, ii -th chip is located in the cell at the intersection of sxisxi -th row and syisyi -th column. In one action, Petya can move all the chips to the left, right

Educational Codeforces Round 84 (Rated for Div. 2)

原题链接 目录 题外话 A A题意 A思路 A代码 B 题意 思路 代码 C 题意 思路 代码 E 题意 思路 代码 题外话 被教育了,读题不认真,明明能四题的(靠),竟然打不过jy,很烦 A A题意 给你n,m(m是奇数的数量)问你是否可以使用m个奇数(不相同的)构成n A思路 自己上来以为是判断奇偶就死了 其实还有点其他的东西,比如k个互不相同的奇数最小就是k*k(记录一下) A代码 #include <bits/stdc++.h> #include <ext/pb_ds/assoc

Educational Codeforces Round 84 (Rated for Div. 2), problem: (A) Sum of Odd Integers

A. 被卡了好久,样例的第一感觉n%k==0则YES 后来写式子,交了发n>=k*k 虽然写的时候也注意到了n-k必须是偶数(k个奇数和的奇偶性与k相同,故n与k奇偶性相同) 最后才想到,可以构造 前k-1个数为1~k-1 剩下的即为第k个数 #include<bits/stdc++.h> #define ll long long using namespace std; //const int N=1e4+5; int main(){ int T; ios::sync_with_std

Educational Codeforces Round 84 (Rated for Div. 2) A-E题解

A. Sum of Odd Integers 首先可以算出从1开始到第k个奇数之和.如果和大于n,则不可能存在k个奇数加和等于n,否则用n减去前k个奇数的和,这个差值若是偶数,直接加到最大的奇数上,就可以满足题意要求,否则输出no. 1 #include<bits/stdc++.h> 2 using namespace std; 3 typedef long long ll; 4 int main(){ 5 int t; 6 cin>>t; 7 while(t--){ 8 ll n

Educational Codeforces Round 69 (Rated for Div. 2) B - Pillars

Educational Codeforces Round 69 (Rated for Div. 2) B - Pillars There are n pillars aligned in a row and numbered from 1 to n. Initially each pillar contains exactly one disk. The i-th pillar contains a disk having radius ai. You can move these disks

Educational Codeforces Round 71 (Rated for Div. 2) D - Number Of Permutations

原文链接:https://www.cnblogs.com/xwl3109377858/p/11405773.html Educational Codeforces Round 71 (Rated for Div. 2) D - Number Of Permutations You are given a sequence of n pairs of integers: (a1,b1),(a2,b2),…,(an,bn). This sequence is called bad if it is

Educational Codeforces Round 36 (Rated for Div. 2)

Educational Codeforces Round 36 (Rated for Div. 2) F. Imbalance Value of a Tree You are given a tree T consisting of n vertices. A number is written on each vertex; the number written on vertex i is ai. Let's denote the function I(x,?y) as the differ

Educational Codeforces Round 36 (Rated for Div. 2) 题解

Educational Codeforces Round 36 (Rated for Div. 2) 题目的质量很不错(不看题解做不出来,笑 Codeforces 920C 题意 给定一个\(1\)到\(n\)组成的数组,只可以交换某些相邻的位置,问是否可以将数组调整为升序的 解题思路 首先如果每个数都能通过交换到它应该到的位置,那么就可以调整为升序的. 但实际上交换是对称的,如果应该在的位置在当前位置前方的数都交换完成,那么整体就是排好序的,因为不可能所有不在相应位置的数都在相应位置的后方.