# 第十四届蓝桥杯三月真题刷题训练——第 5 天（3.8）

ck 2023-03-08 09:02:39

## 数的分解 - 蓝桥云课 (lanqiao.cn)

``````#include <iostream>
#include <bits/stdc++.h>
#include <cstring>
#include <algorithm>
#include <vector>
#include <set>
#include <queue>
#define x first
#define y second
#define endl '\n'
#define ms(x,y) memset(x,y,sizeof x)
#define ios ios::sync_with_stdio(0),cin.tie(0),cout.tie(0);
using namespace std;

typedef long long LL;
typedef pair<int,int> PII;
typedef pair<double,double> PDD;
typedef pair<double,int> PDI;
typedef pair<char,int> PCI;
typedef pair<string,int> PSI;
typedef pair<int,string> PIS;
typedef pair<LL,LL> PLL;
//typedef __int128 i128;
typedef unsigned long long ULL;
const int N = 100+ 10,M = N * 2 ,INF = 0x3f3f3f3f ;
const double eps = 1e-7;

int p[N],cnt;
struct node{
int a,b,c;
};
bool check(int x)
{
int t;
while(x)
{
t = x % 10;x/=10;
if(t == 2 || t == 4 )return 0;
}
return 1;
}

int n = 2019,ans =0 ;
int q[N];
void solve()
{
map<node,int> mp;
for(int i=1;i<=n ;i++)
for(int j=i+1;j<=n;j ++)
{
int k = n - i - j;
if(check(i) && check(j) && check(k) && k > j )
{
if(i + j + k ==  n ) ans ++ ;
}
}
cout <<ans <<endl;
}

signed main()
{
//  freopen("1.txt","w",stdout);
// 	ios

int T=1;
//    cin>>T;
int now = 1;
while(T -- )
{
//      cout<<"Case ";
//      cout<<"Case #";
//      cout<< now ++ <<": ";
solve();
}

return 0;
}

``````

## 猜生日 - 蓝桥云课 (lanqiao.cn)

``````#include <iostream>
#include <bits/stdc++.h>
#include <cstring>
#include <algorithm>
#include <vector>
#include <set>
#include <queue>
#define x first
#define y second
#define endl '\n'
#define ms(x,y) memset(x,y,sizeof x)
#define ios ios::sync_with_stdio(0),cin.tie(0),cout.tie(0);
using namespace std;

typedef long long LL;
typedef pair<int,int> PII;
typedef pair<double,double> PDD;
typedef pair<double,int> PDI;
typedef pair<char,int> PCI;
typedef pair<string,int> PSI;
typedef pair<int,string> PIS;
typedef pair<LL,LL> PLL;
//typedef __int128 i128;
typedef unsigned long long ULL;
const int N = 100+ 10,M = N * 2 ,INF = 0x3f3f3f3f ;
const double eps = 1e-7;

int n =20120312,m=19000101;

void solve()
{
for(int i=m;i<=n;i++)
{
int year = i / 10000,month = i %10000 / 100 ,day = i % 100;

if(month != 6 ) continue;
if(i % 2012 || i % 3 || i % 12 ) continue;
if(month > 12 || month == 0 )continue;
if(day > 30 ) continue;
cout <<i <<endl;
}

}

signed main()
{
//  freopen("1.txt","w",stdout);
// 	ios

int T=1;
//    cin>>T;
int now = 1;
while(T -- )
{
//      cout<<"Case ";
//      cout<<"Case #";
//      cout<< now ++ <<": ";
solve();
}

return 0;
}

``````

## 成绩统计 - 蓝桥云课 (lanqiao.cn)

``````#include <iostream>
#include <bits/stdc++.h>
#include <cstring>
#include <algorithm>
#include <vector>
#include <set>
#include <queue>
#define x first
#define y second
#define endl '\n'
#define ms(x,y) memset(x,y,sizeof x)
#define ios ios::sync_with_stdio(0),cin.tie(0),cout.tie(0);
using namespace std;

typedef long long LL;
typedef pair<int,int> PII;
typedef pair<double,double> PDD;
typedef pair<double,int> PDI;
typedef pair<char,int> PCI;
typedef pair<string,int> PSI;
typedef pair<int,string> PIS;
typedef pair<LL,LL> PLL;
//typedef __int128 i128;
typedef unsigned long long ULL;
const int N = 100+ 10,M = N * 2 ,INF = 0x3f3f3f3f ;
const double eps = 1e-7;

void solve()
{
int n;cin >> n;
int a1=0,a2=0;
int t;
for(int i=1;i<=n;i ++)
{
cin >> t;
if(t >= 85 )a1 ++;
if(t >= 60) a2 ++ ;
}

a1 = a1 * 100.0 / n + 0.5;
a2 = a2 * 100.0 / n  + 0.5 ;

cout<< a2 <<"%\n"<<a1  <<"%\n";
}

signed main()
{
//  freopen("1.txt","w",stdout);
// 	ios

int T=1;
//    cin>>T;
int now = 1;
while(T -- )
{
//      cout<<"Case ";
//      cout<<"Case #";
//      cout<< now ++ <<": ";
solve();
}

return 0;
}

``````

## 最大和 - 蓝桥云课 (lanqiao.cn)

``````#include <iostream>
#include <bits/stdc++.h>
#include <cstring>
#include <algorithm>
#include <vector>
#include <set>
#include <queue>
#define x first
#define y second
#define endl '\n'
#define ms(x,y) memset(x,y,sizeof x)
#define ios ios::sync_with_stdio(0),cin.tie(0),cout.tie(0);
using namespace std;

typedef long long LL;
typedef pair<int,int> PII;
typedef pair<double,double> PDD;
typedef pair<double,int> PDI;
typedef pair<char,int> PCI;
typedef pair<string,int> PSI;
typedef pair<int,string> PIS;
typedef pair<LL,LL> PLL;
//typedef __int128 i128;
typedef unsigned long long ULL;
const int N = 10000+ 10,M = N * 2 ,INF = 0x3f3f3f3f ;
const double eps = 1e-7;

int get(int x)
{
for(int i=2;i<=x;i ++ )
if(x % i == 0 ) return i;
return 1;
}

int n;
int a[N],f[N];
void solve()
{
cin >> n;
for(int i=1;i<=n; i++ ) cin >> a[i];
ms(f,-0x3f);
f[1] = a[1];
for(int i=1;i<=n;i++)
{
int len= get(n-i);

for(int r=i+1;r<=i + len ;r ++ )
f[r] = max(f[r],f[i] + a[r]);

}
cout << f[n]<<endl;

}

signed main()
{
//  freopen("1.txt","w",stdout);
// 	ios

int T=1;
//    cin>>T;
int now = 1;
while(T -- )
{
//      cout<<"Case ";
//      cout<<"Case #";
//      cout<< now ++ <<": ";
solve();
}

return 0;
}

``````

...全文
30 回复 打赏 收藏 转发到动态 举报

50,779

• 近7日
• 近30日
• 至今

刷题！