第十四届蓝桥杯三月真题刷题训练——第 3 天(3.6)
目录
门牌制作 - 蓝桥云课 (lanqiao.cn)
#include <bits/stdc++.h>
#include <iostream>
#include <cstring>
#include <algorithm>
#include <set>
#define x first
#define y second
#define ios ios::sync_with_stdio(0),cin.tie(0),cout.tie(0);
using namespace std;
typedef pair<int,int> PII;
typedef pair<char,int> PCI;
typedef long long LL;
//typedef __int128 i128;
typedef unsigned long long ULL;
const int N=4e5+10,INF = 0x3f3f3f3f ;
const double eps = 1e-7;
LL res= 0;
int cnt(int x)
{
int c=0,t;
while(x)
{
t = x % 10;x/=10;
if(t == 2 ) c ++ ;
}
return c;
}
int main()
{
for(int i=1;i<=2020;i ++ )
{
res += cnt(i);
}
cout << res <<endl;
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<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= 20000 + 10,M = 55 ;
const int INF = 0x3f3f3f3f ,mod = 1e9 + 7 ,P = 131;
const double eps = 1e-7;
LL n = 2021041820210418;
LL cnt,p[N];
void solve()
{
for(LL i =1;i <= n/i;i ++ )
{
if(n % i == 0)
{
p[cnt ++ ] = i;
if(n/i != i )
{
p[cnt ++ ] = n/i;
}
}
}
LL res=0;
for(LL i=0;i<cnt ;i++ )
for(LL j=0;j<cnt;j ++ )
for(LL k= 0;k< cnt ;k ++ )
{
res += (p[i] * p[j] * p[k] == n );
}
cout << res <<endl;
}
signed main()
{
// freopen("1.txt","r",stdin);
int T=1;
// cin>>T;
int now = 1;
while(T -- )
{
// 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<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 = 55 ;
const int INF = 0x3f3f3f3f ,mod = 1e9 + 7 ,P = 131;
const double eps = 1e-7;
int m,n,w[N][N],f[N][N];
void solve()
{
cin >> n >> m ;
for(int i=3;i<=n + 2 ;i ++ )
for(int j=3;j<=m +2; j ++ )
cin >> w[i][j];
ms(f,-0x3f);
f[3][3] = w[3][3];
for(int i=3;i<=n + 2 ;i ++ )
for(int j=3;j<=m +2; j ++ )
{
if(i == 3 && j == 3 ) continue;
int &t = f[i][j];
for(int x=1;x<=3 && i -x >= 3 ;x ++ )
{
t =max(t,f[i-x][j]);
}
for(int y=1;y <= 3 && j - y >= 3 ; y ++ )
{
t = max(t,f[i][j-y]);
}
t += w[i][j];
}
cout << f[n + 2 ][m + 2 ] <<endl;
}
signed main()
{
// freopen("1.txt","r",stdin);
int T=1;
// cin>>T;
int now = 1;
while(T -- )
{
// 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<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 = 55 ;
const int INF = 0x3f3f3f3f ,mod = 1e9 + 7 ,P = 131;
const double eps = 1e-7;
LL n,m,a[N],s[N],b[N],c[N];
LL s1,s2,res;
void solve()
{
cin >> n;
for(int i=1;i <= n; i++ )cin >> a[i],s[i] = s[i-1] + a[i];
cin >> m;
while(m--)
{
int l,r;cin >> l >> r;
b[l] ++ ,b[r + 1] --;
s1 += s[r] - s[l-1];
}
for(int i=1;i<= n;i ++ ) c[i] = c[i-1] + b[i];
sort(c + 1, c + n + 1);// 将每个数的出现次数排序
sort(a + 1, a + n + 1);// 将原来每个数大小排序
for(int i=1;i<=n;i ++ )
{
s2 += c[i] * a[i];
// 重新分配每个数出现的次数 ,数值小的出现次数少,数值大的出现次数多
}
cout << s2 - s1 << endl;
}
signed main()
{
// freopen("1.txt","r",stdin);
int T=1;
// cin>>T;
int now = 1;
while(T -- )
{
// cout<<"Case ";
// cout<< now ++ <<": ";
solve();
}
return 0;
}
...全文
相关推荐
第十三届蓝桥杯EDA组省赛真题 训练题
第十三届EDA省赛一等奖国赛二等奖,学好资源中的双层板绘制,有客观题的知识了解即可拿奖,总结:有手就行
蓝桥杯18天的刷题量,共180道题
ggui20:发布的时候设为0积分下载,可能系统会自动修改,如果有修改,请私聊我 蓝桥杯18天的刷题量,共180道题
python蓝桥杯省赛刷题总结+真题
python蓝桥杯省赛刷题总结+真题
蓝桥杯历年真题及测试数据.zip
蓝桥杯往年的比赛真题和测试数据,可以写个脚本一键导入到自己的OJ,蓝桥杯考前复习必备,官方的后台数据,质量没问题!
13-15届蓝桥杯EDA模拟题和真题
第十三届蓝桥杯EDA赛训练试题一资源包 第十三届蓝桥杯EDA赛训练试题二资源包 第十三届蓝桥杯EDA赛训练试题三资源包 第十四届蓝桥杯EDA赛模拟题一 第十四届蓝桥杯EDA赛模拟题二 第十四届蓝桥杯EDA省赛真题 第十五届蓝桥杯EDA赛模拟试题一(嘉立创EDA提供) 第十五届蓝桥杯EDA赛模拟试题二(嘉立创EDA提供) 4T十五届模拟三


