# 2022蓝桥杯选讲配套题解（updating）

#include <bits/stdc++.h>

using namespace std;
#define all(c) (c).begin(), (c).end()
#define rev(a) reverse((a).begin(), (a).end())
#define each(x, a) for(auto& x : a)
#define mst(a, x) memset(a, x, sizeof(a))
#define rep(i, from, to) for(int i = from;i<to;i++)
#define rrep(i, from, to) for(i128 i = from;i>=to;i--)
#define to_uni(a) a.erase(unique(begin(a), end(a)), end(a))
#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define endl "\n"
#define i128 __int128
#define ll long long
typedef pair<int, int> pii;
const int mod = 1e9 + 7;
const int dx[4]{1, 0, -1, 0}, dy[4]{0, 1, 0, -1};
const int fx[8] = {-1, -1, 0, 1, 1, 1, 0, -1}, fy[8] = {0, 1, 1, 1, 0, -1, -1, -1};
const int N = 1e5 + 10;
//int n, m;
int month[13] = {0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};

void solve() {
cout << 2 + 2 * 9 + 2 * 9 * 9 * 9;
}

int main() {
ios::sync_with_stdio(false);
cin.tie(0), cout.tie(0);
int T = 1;
//    cin >> T;
while (T--) {
solve();
}
return 0;
}


#include <bits/stdc++.h>

using namespace std;
#define all(c) (c).begin(), (c).end()
#define rev(a) reverse((a).begin(), (a).end())
#define each(x, a) for(auto& x : a)
#define mst(a, x) memset(a, x, sizeof(a))
#define rep(i, from, to) for(int i = from;i<to;i++)
#define rrep(i, from, to) for(i128 i = from;i>=to;i--)
#define to_uni(a) a.erase(unique(begin(a), end(a)), end(a))
#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define endl "\n"
#define i128 __int128
#define ll long long
typedef pair<int, int> pii;
const int mod = 1e9 + 7;
const int dx[4]{1, 0, -1, 0}, dy[4]{0, 1, 0, -1};
const int fx[8] = {-1, -1, 0, 1, 1, 1, 0, -1}, fy[8] = {0, 1, 1, 1, 0, -1, -1, -1};
const int N = 1e5 + 10;
//int n, m;
int month[13] = {0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};

void solve() {
set<string> sortStr;
for (char ch = '0'; ch <= '9'; ch++) {
if (ch + 2 <= '9') {
string t;
t += ch;
t += ch + 1;
t += ch + 2;
sortStr.insert(t);
}
if (ch - 2 >= '0') {
string t;
t += ch;
t += ch - 1;
t += ch - 2;
sortStr.insert(t);
}
}
for (int m = 1; m <= 12; m++) {
for (int d = 1; d <= month[m]; d++) {
int date = 20220000 + m * 100 + d;
string s = to_string(date);
for (auto &str: sortStr) {
if (s.find(str) != s.npos) {
cout << s << endl;
break;
}
}
}
}
}

int main() {
ios::sync_with_stdio(false);
cin.tie(0), cout.tie(0);
int T = 1;
//    cin >> T;
while (T--) {
solve();
}
return 0;
}


#include <bits/stdc++.h>

using namespace std;
#define all(c) (c).begin(), (c).end()
#define rev(a) reverse((a).begin(), (a).end())
#define each(x, a) for(auto& x : a)
#define mst(a, x) memset(a, x, sizeof(a))
#define rep(i, from, to) for(int i = from;i<to;i++)
#define rrep(i, from, to) for(i128 i = from;i>=to;i--)
#define to_uni(a) a.erase(unique(begin(a), end(a)), end(a))
#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define endl "\n"
#define i128 __int128
#define ll long long
typedef pair<int, int> pii;
const int mod = 1e9 + 7;
const int dx[4]{1, 0, -1, 0}, dy[4]{0, 1, 0, -1};
const int fx[8] = {-1, -1, 0, 1, 1, 1, 0, -1}, fy[8] = {0, 1, 1, 1, 0, -1, -1, -1};
const int N = 1e5 + 10;
//int n, m;
int month[13] = {0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};

void solve() {
ll a, b, n;
cin >> a >> b >> n;
ll eachWeek = a * 5 + b * 2;
ll weeks = n / eachWeek;
ll sx = n % eachWeek;
ll ans = 7 * weeks;
for (int i = 1; i <= 7; i++) {
if (i <= 5) sx -= a;
else sx -= b;
if (sx <= 0) {
ans += i;
cout << ans;
break;
}
}

}

int main() {
ios::sync_with_stdio(false);
cin.tie(0), cout.tie(0);
int T = 1;
//    cin >> T;
while (T--) {
solve();
}
return 0;
}


#include <bits/stdc++.h>

using namespace std;
#define all(c) (c).begin(), (c).end()
#define rev(a) reverse((a).begin(), (a).end())
#define each(x, a) for(auto& x : a)
#define mst(a, x) memset(a, x, sizeof(a))
#define rep(i, from, to) for(int i = from;i<to;i++)
#define rrep(i, from, to) for(i128 i = from;i>=to;i--)
#define to_uni(a) a.erase(unique(begin(a), end(a)), end(a))
#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define endl "\n"
#define i128 __int128
#define ll long long
typedef pair<int, int> pii;
const int mod = 1e9 + 7;
const int dx[4]{1, 0, -1, 0}, dy[4]{0, 1, 0, -1};
const int fx[8] = {-1, -1, 0, 1, 1, 1, 0, -1}, fy[8] = {0, 1, 1, 1, 0, -1, -1, -1};
const int N = 1e5 + 10;
//int n, m;
int month[13] = {0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};

void solve() {
int n;
cin >> n;
for (int i = 1; i <= n; i++) {
cout << max(n - i, i - 1) * 2 << endl;
}

}

int main() {
ios::sync_with_stdio(false);
cin.tie(0), cout.tie(0);
int T = 1;
//    cin >> T;
while (T--) {
solve();
}
return 0;
}


#include <bits/stdc++.h>

using namespace std;
#define all(c) (c).begin(), (c).end()
#define rev(a) reverse((a).begin(), (a).end())
#define each(x, a) for(auto& x : a)
#define mst(a, x) memset(a, x, sizeof(a))
#define rep(i, from, to) for(int i = from;i<to;i++)
#define rrep(i, from, to) for(i128 i = from;i>=to;i--)
#define to_uni(a) a.erase(unique(begin(a), end(a)), end(a))
#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define endl "\n"
#define i128 __int128
#define ll long long
typedef pair<int, int> pii;
const int mod = 1e9 + 7;
const int dx[4]{1, 0, -1, 0}, dy[4]{0, 1, 0, -1};
const int fx[8] = {-1, -1, 0, 1, 1, 1, 0, -1}, fy[8] = {0, 1, 1, 1, 0, -1, -1, -1};
const int N = 1e5 + 10;
//int n, m;
int month[13] = {0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};

void solve() {
int n, m;
cin >> n;
int n1, n2;
cin >> n1;
vector<int> a(n1 + 1);
for (int i = n1; i >= 1; i--) {
cin >> a[i];
}
cin >> n2;
vector<int> b(n1 + 1);
for (int i = n2; i >= 1; i--) {
cin >> b[i];
}
vector<int> jz(max(n1, n2) + 1);
for (int i = 1; i <= max(n1, n2); i++) {
jz[i] = max({2, a[i] + 1, b[i] + 1});
}
ll ans = 0;
for (int i = 1; i <= max(n1, n2); i--) {
int t = a[i] - b[i];
ans=(ans+1ll*)

}

}

int main() {
ios::sync_with_stdio(false);
cin.tie(0), cout.tie(0);
int T = 1;
//    cin >> T;
while (T--) {
solve();
}
return 0;
}


#include<bits/stdc++.h>

using namespace std;

int main() {
ios::sync_with_stdio(false);
cin.tie(0), cout.tie(0);
string s = "WHERETHEREISAWILLTHEREISAWAY";
sort(s.begin(), s.end());
cout << s;
return 0;
}

#include<bits/stdc++.h>

using namespace std;
int monthDays[13] = {0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};

int main() {
ios::sync_with_stdio(false);
cin.tie(0), cout.tie(0);
int yy = 0, mm = 0, time = 0;
for (int i = 0; i <= 9999; i++) {
map<int, int> re;
int t = i;
for (int j = 0; j < 4; j++) {
re[t % 10]++;
t /= 10;
}
if (re.size() != 2) continue;
bool f3 = false, f1 = false;
for (auto &[x, y]: re) {
if (y == 3) f3 = true;
if (y == 1) f1 = true;
}
if (f3 && f1) {
yy++;
int month = i / 100;
int day = i % 100;
if (month >= 1 && month <= 12)
if (day >= 1 && day <= monthDays[month]) mm++;
if (month >= 0 && month <= 23 && day >= 0 && day <= 59) time++;

}
}
long long ans = yy * mm * time;
cout << ans;
return 0;
}

#include<bits/stdc++.h>

using namespace std;

int main() {
ios::sync_with_stdio(false);
cin.tie(0), cout.tie(0);

int x = 1189, y = 841;
string s;
cin >> s;
int n = s[1] - '0';
for (int i = 0; i < n; i++) {
if (x > y) x /= 2;
else y /= 2;
}
cout << max(x, y) << "\n" << min(x, y) << endl;

return 0;
}

#include<bits/stdc++.h>

using namespace std;
using ll = long long;
const int N = 2e5 + 10;
int a[N];
int k[N];

int main() {
ios::sync_with_stdio(false);
cin.tie(0), cout.tie(0);
int n;
cin >> n;
k[0] = 0;
for (int i = 1; i <= n; i++) {
cin >> a[i];
k[i] = k[i - 1] + a[i];
}
ll ans = 0;
for (int i = 1; i <= n; i++) {
ans += a[i] * (k[n] - k[i]);
}
cout << ans;
return 0;
}

#include<bits/stdc++.h>

using namespace std;

int calc(int x) {
int ans = 0;
while (x != 0) ans += x % 10, x /= 10;
return ans;
}

int main() {
ios::sync_with_stdio(false);
cin.tie(0), cout.tie(0);
int T = 1;
int n, m;
cin >> n >> m;
vector<pair<int, int>> a;
for (int i = 1; i <= n; i++) {
a.push_back({calc(i), i});
}
sort(a.begin(), a.end());
cout << a[m - 1].second;
return 0;
}

#include<bits/stdc++.h>

using namespace std;

int main() {
ios::sync_with_stdio(false);
cin.tie(0), cout.tie(0);
int n, m, x, t;
cin >> n >> m >> x;
int f[100001];
f[0] = 0;
//f[i]表示右端点为i的时候，满足区间内有已获知为x的左端的最大值。
map<int, int> last;
for (int i = 1; i <= n; i++) {
cin >> t;
f[i] = max(f[i - 1], last[x ^ t]);
last[t] = i;
}
while (m--) {
int l, r;
cin >> l >> r;
if (f[r] >= l) {
cout << "yes\n";
} else {
cout << "no\n";
};
}

return 0;
}

#include<bits/stdc++.h>

using namespace std;
const int N = 1e5 + 10;
int a[N];
int k[N];
int t[N];

int main() {
ios::sync_with_stdio(false);
cin.tie(0), cout.tie(0);
int n, m;
cin >> n;
for (int i = 1; i <= n; i++) cin >> a[i];
cin >> m;
while (m--) {
int l, r;
cin >> l >> r;
k[l]++;
k[r + 1]--;
}
int now = 0;
long long pre = 0;
for (int i = 1; i <= n; i++) {
now += k[i];
pre += 1ll * now * a[i];
t[i] = now;
}
sort(a + 1, a + 1 + n);
sort(t + 1, t + 1 + n);
long long ans = 0;
for (int i = 1; i <= n; i++) {
ans += 1ll * a[i] * t[i];
}
cout << ans - pre;
return 0;
}