Some depressed ... ARC brush bar
ARC001
A. Enter how output will not WA's ...
#include <bits/stdc++.h>
using namespace std;
int cnt[4];
int n;
int main() {
cin >> n;
for (int i = 1; i <= n; ++i) {
char s;
cin >> s;
++cnt[s - '1'];
}
cout << *max_element(cnt, cnt + 4) << ' ' << *min_element(cnt, cnt + 4) << '\n';
return 0;
}
B. put a number into several 1510 addition and subtraction, find the minimum number of items
first if the number \ (\ geq 10 \) it must use \ (10 \) optimal, $ <$ 10 of play a little table.
#include <bits/stdc++.h>
using namespace std;
int ans[] = {0, 1, 2, 3, 2, 1, 2, 3, 3, 2, 1};
int main() {
int a, b;
cin >> a >> b;
int c = abs(a - b);
cout << c / 10 + ans[c % 10] << endl;
return 0;
}