九进制转十进制 - 蓝桥云课 (lanqiao.cn)
题目描述
分析
#include<bits/stdc++.h>
using namespace std;
int main()
{cout << 2 * 9 * 9 * 9 + 0 * 9 * 9 + 2 * 9 + 2;return 0;
}
顺子日期 - 蓝桥云课 (lanqiao.cn)
题目描述
分析
全部枚举
#include<bits/stdc++.h>
using namespace std;
int ans = 0;
int m[13] = {0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
bool is_ren(int x)
{if((x % 4 == 0 && x % 100 != 0) || x % 400 == 0)return true;return false;
}
int main()
{if(is_ren(2022))m[2] = 29;for(int i = 1; i <= 12; i ++){for(int j = 1; j <= m[i]; j ++){int cnt = 0;string s = "2022";if(i < 10)s += "0";string k = to_string(i);//cout << k << "KKK" << '\n';s += k;if(j < 10)s += "0";string q = to_string(j);s += q;//cout << s << '\n';for(int p = 0; p < s.size() - 1; p ++){if(s[p] - '0' + 1 == s[p + 1] - '0' && s[p + 1] - '0' + 1 == s[p + 2] - '0')cnt ++;}if(cnt)ans ++;}}cout << ans;return 0;
}