这里会显示出您选择的修订版和当前版本之间的差别。
| 后一修订版 | 前一修订版 | ||
|
2020-2021:teams:namespace:牛客多校第九场 [2020/08/21 08:52] serein 创建 |
2020-2021:teams:namespace:牛客多校第九场 [2020/08/21 09:07] (当前版本) serein [I] |
||
|---|---|---|---|
| 行 1: | 行 1: | ||
| ======牛客多校第九场====== | ======牛客多校第九场====== | ||
| + | =====A===== | ||
| + | |||
| + | 一道递归的签到题,用python写一行就够。 | ||
| + | |||
| + | <hidden> | ||
| + | <code C> | ||
| + | print(eval(input().replace("(", "**("))) | ||
| + | </code> | ||
| + | </hidden> | ||
| + | |||
| + | =====I===== | ||
| + | |||
| + | 把一堆数字,重新排列拆成两个数要求乘积最小,分析后可以找到规律,按规律模拟即可。 | ||
| + | |||
| + | <hidden> | ||
| + | <code C> | ||
| + | #include<bits/stdc++.h> | ||
| + | using namespace std; | ||
| + | #define _rep(i, a, n) for(int i = a; i < n; i++) | ||
| + | const int maxn = 100010; | ||
| + | int a[maxn], aa[maxn], res[maxn]; | ||
| + | int main(){ | ||
| + | int t, tmp; | ||
| + | cin >> t; | ||
| + | while(t--){ | ||
| + | int cnt = 0; | ||
| + | int n; | ||
| + | cin >> n; | ||
| + | _rep(i, 0, n){ | ||
| + | cin >> tmp; | ||
| + | if(tmp == 0) cnt++; | ||
| + | else{ | ||
| + | a[i - cnt] = tmp; | ||
| + | } | ||
| + | } | ||
| + | sort(a, a + n - cnt); | ||
| + | int top = n - 2; | ||
| + | int bb = a[0]; | ||
| + | aa[n - 1] = 0; | ||
| + | aa[top--] = a[1]; | ||
| + | _rep(i, 0, cnt) aa[top--] = 0; | ||
| + | _rep(i, 2, n - cnt){ | ||
| + | aa[top--] =a[i]; | ||
| + | } | ||
| + | _rep(i, 0, n){ | ||
| + | tmp = bb * aa[i] + res[i]; | ||
| + | if(tmp > 9){ | ||
| + | aa[i] = tmp % 10; | ||
| + | res[i+1] += tmp / 10; | ||
| + | } | ||
| + | else aa[i] = tmp; | ||
| + | } | ||
| + | if(aa[n - 1] > 0) printf("%d", aa[n-1]); | ||
| + | res[n-1] = 0; | ||
| + | for(int i = n - 2; i >= 0; i--) printf("%d", aa[i]), res[i] = 0; | ||
| + | cout << endl; | ||
| + | } | ||
| + | } | ||
| + | </code> | ||
| + | </hidden> | ||