「游记」Codeforces Round #729 (Div. 2)

水平还是菜啊,开始25分钟做了A和B,直到结束也就只做了A和B,加完rating还是newbie,我太菜了QwQ

A. Odd Set

问给出的 \(2*n\) 个数之间能否两两配对出 \(n\) 个奇数。显然是奇数个数等于偶数个数的情况,2分钟A掉了

B. Plus and Multiply

赛时想了个做法,感觉是对的,感觉很合理,但没有严格证明。25分钟的时候交了一发过了。

官方题解也是这个思路,证明如下↓

First judge specially if \(b=1\).

Let's consider when \(n\) is in \(S\). The answer is when the smallest number \(m\) in \(S\) that \(n\mod b=m \mod b\) is less than \(n\). It's easy to see that a new case of \(x \mod b\) can only appear when you use \(×a\) to generate a new element. So the smallest number \(m\) in \(S\) that \(m \mod b=k\) must be a power of \(a\).

Find all powers of \(a\) that is smaller than \(n\). If there is one \(m=ak\) that \(n \mod b=m \mod b\), the answer is yes. Otherwise it's no. Time complexity is \(O(logn)\).

C. Strange Function

就是想不出来怎么做。赛时打了个表,发现极其有规律,但无从下手。

思考

For a given \(x\), when is \(f(n)\) equal to \(x\)?

上一篇:sql server 获取数据字段(表的字段和类型信息)


下一篇:怎样写一个好的 Gherkin