Day23:Marriage

讲述了作者参加位于偏远山村的一场婚礼的经历,意外发现即使在这样的地方也能享受到移动4G信号,甚至可以在线观看S6直播。当天晚些时候,他还观看了电影《釜山行》。

早上8点,我、妈妈、爷爷、叔叔一家坐上面包车驶上通向老虎洞的道路,葫芦岛有5个叫老虎洞的地方,以至于我没有导航正确,但司机听爷爷的话,最后到了徐家沟饭店。

9:30我们便到了,等到了10:50宴席才开始。小叔结婚了,新娘是一个很胖的女人,比他自己还胖,据其他人说,他掉进了钱堆里。小叔很有钱,一直在宁波发展,现在经营着奢侈品生意,这是我对他所知的一切。我没有想到偏远的山区竟会有移动4G信号,还可以看s6直播。

中午时我们便离开了,很快的,我回去的理由便是参加婚礼,现在结束了,超乎想象的快。

晚上看了釜山行,很有意思。


10.1 Saturday


链接:https://ac.nowcoder.com/acm/contest/108299/L 来源:牛客网 题目描述 It's a loving community! There are 𝑛 n residents in the community, and each resident 𝑖 ( 1 ≤ 𝑖 ≤ 𝑛 ) i (1≤i≤n) in the community has a unique resident 𝑎 𝑖 ( 1 ≤ 𝑖 ≤ 𝑛 ) a i ​ (1≤i≤n) in the community whom he/she loves so much. Each two residents love different residents. A resident can love himself / herself. It is guaranteed that 𝑛 n is even. One day, a bad thing happens: They need to choose 2 2 residents to be forbidden to get married forever. And to prevent such a thing from happening in the future, the rest 𝑛 − 2 n−2 residents decide to get married as 𝑛 2 − 1 2 n ​ −1 couples, each couple consisting of 2 2 persons (of course). It makes no sense that a couple consists of resident 𝑥 x and resident 𝑦 y while neither 𝑥 x loves 𝑦 y nor 𝑦 y loves 𝑥 x, so such a thing never happens. So, as the planner, you need to figure out how you can arrange this. You want to know the number of different marriage plans. Two marriage plans are considered different if at least one of the following conditions is satisfied: In one plan, a person 𝑖 i is married, and in the other, he/she is not. In one plan, a person 𝑖 i is married to 𝑗 j, and in the other, he/she is not married to 𝑗 j. As the number of plans can be quite enormous, output it modulo 998 244 353 998 244 353. 输入描述: Each test contains multiple test cases. The first line contains the number of test cases 𝑇 ( 1 ≤ 𝑇 ≤ 1 0 4 ) T (1≤T≤10 4 ) . Each test case consists of two lines. The first line contains 1 1 integer 𝑛 ( 4 ≤ 𝑛 ≤ 5 × 1 0 5 ) n (4≤n≤5×10 5 ), the number of residents in the community. It's guaranteed that 𝑛 n is even. The second line contains 𝑛 n integers 𝑎 1 , 𝑎 2 , … , 𝑎 𝑛 ( 1 ≤ 𝑎 𝑖 ≤ 𝑛 ) a 1 ​ ,a 2 ​ ,…,a n ​ (1≤a i ​ ≤n), where 𝑎 𝑖 a i ​ represents the one that the resident 𝑖 i loves. It is guaranteed that if 𝑖 ≠ 𝑗 ( 1 ≤ 𝑖 , 𝑗 ≤ 𝑛 ) i  ​ =j (1≤i,j≤n), 𝑎 𝑖 ≠ 𝑎 𝑗 a i ​  ​ =a j ​ . It is guaranteed that ∑ 𝑛 ∑n over all test cases in one test will not exceed 5 × 1 0 5 5×10 5 . 输出描述: For each test case, output 1 1 integer: the number of different marriage plans modulo 998 244 353 998 244 353. 示例1 输入 复制 2 4 1 3 4 2 6 3 4 5 6 2 1 输出 复制 3 9
最新发布
07-20
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值