49,440
社区成员




第一题主要是判断回文,那个三角不三角都不重要了
#include <bits/stdc++.h>
#define mpr make_pair
#define pb push_back
#define fi first
#define se second
#define endl '\n'
using namespace std;
typedef long long ll;
typedef pair<int,int> PII;
const int INF = 0x3f3f3f3f;
const int N = 6e3 + 10;
bool check(int n)
{
string val = to_string(n);
string tmp = val;
reverse(tmp.begin(),tmp.end());
if(tmp == val) return true;
else return false;
}
void solve(){
// cout << 363* 364/2;
// cout << (20220514 > (N*(N+1)/2));
for(int i = N;i < INF;i++)
{
int num = i*(i+1)/2;
if(num > 20220514 && check(num))
{
cout << num;
return;
}
}
}
void run()
{
ios::sync_with_stdio(false);
cin.tie(nullptr);
cout.tie(nullptr);
}
int main() {
run();
int t;
t = 1;
while(t--) {
solve();
}
return 0;
}
第二题学一个分解质因数
#include <bits/stdc++.h>
#define mpr make_pair
#define pb push_back
#define fi first
#define se second
#define endl '\n'
using namespace std;
typedef long long ll;
typedef pair<int,int> PII;
const int INF = 0x3f3f3f3f;
const int N = 1e5 + 10;
bool get_ans(int n)
{
int cnt = 0;
for(int i = 2;i * i <= n;i++)
{
if(n % i == 0)
{
while(n%i == 0)
{
n /= i;
cnt ++;
}
}
}
if(n != 1) cnt ++;
if(cnt == 12) return true;
else return false;
}
void solve(){
int ans = 0;
for(int i = 2333333;i <= 23333333;i++)
{
if(get_ans(i)) ans ++;
}
cout << ans;
}
void run()
{
ios::sync_with_stdio(false);
cin.tie(nullptr);
cout.tie(nullptr);
}
int main() {
run();
int t;
t = 1;
while(t--) {
solve();
}
return 0;
}