4.2w+
社区成员
#include<bits/stdc++.h>
using namespace std;
bool pd(int x)
{
while(x)
{
if(x % 10 == 2 || x % 10 == 4)
return false;
x /= 10;
}
return true;
}
int main()
{
ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
int ans = 0;
for(int i = 1; i < 673; i ++)
for(int j = i + 1; j < 2019 - i - j; j ++ )
if(pd(i) && pd(j) && pd(2019 - i - j)) ans ++;
cout << ans;
return 0;
}
#include<bits/stdc++.h>
using namespace std;
int main()
{
for(int i = 19000101; i < 20120312; i ++ )
if(i % 2012 == 0 and i % 3 == 0 and i % 12 == 0 and i / 100 % 100 ==6 and i % 100 < 32)
{
cout << i;
break;
}
return 0;
}
#include<bits/stdc++.h>
using namespace std;
int main()
{
int n, x, T, ans1 = 0, ans2 = 0;
cin >> n;
T = n;
while(T -- )
{
cin >> x;
if(x >= 85) ans1 ++;
if(x >= 60) ans2 ++;
}
cout << ((ans2 * 100 + n / 2) / n) << "%\n" << ((ans1 * 100 + n / 2)/ n) << "%";
return 0;
}
#include<bits/stdc++.h>
using namespace std;
int prime(int n)
{
bool flag = true;
for (int i = 2; i < n; i ++ )
{
if (n % i == 0)
{
int j;
for (j = 2; j < i; j ++ ) if (i % j == 0) break;
if (j != i)
{
flag = 0;
continue;
}
return i;
}
}
return flag == 1 ? n : 0;
}
int main()
{
int n;
cin >> n;
int a[n + 1];
for(int i = 1; i <= n; i ++ )
cin >> a[i];
vector<int> dp(n + 1, INT_MIN);
dp[1] = a[1];
for (int i = 1; i < n; i++)
{
int d = prime(n - i);
for (int j = 1; j <= d; j ++ )
{
if (i + j > n) break;
dp[i + j] = max(dp[i + j], dp[i] + a[j + i]);
}
}
cout << dp[n] << endl;
return 0;
}