哪些网站可以做付费视频/长沙百度地图

哪些网站可以做付费视频,长沙百度地图,一个网站里面只放一个图片怎么做的,苏州做网站费用题目一&#xff1a;验题人的生日【算法赛】 验题人的生日【算法赛】 - 蓝桥云课 (lanqiao.cn) 思路&#xff1a; 1.又是偶数&#xff0c;又是质数&#xff0c;那么只有2喽 AC_Code:C #include <iostream> using namespace std; int main() {cout<<2;return 0; …

题目一:验题人的生日【算法赛】

验题人的生日【算法赛】 - 蓝桥云课 (lanqiao.cn)

思路:

1.又是偶数,又是质数,那么只有2喽

AC_Code:C++

#include <iostream>
using namespace std;
int main()
{cout<<2;return 0;
}

AC_Code:java

import java.util.Scanner;public class Main {public static void main(String[] args) {Scanner scan = new Scanner(System.in);System.out.println(2);scan.close();}
}

题目二:蓝桥小课堂【算法赛】

蓝桥小课堂【算法赛】 - 蓝桥云课 (lanqiao.cn)

思路:

1.组成三角形的条件,任意两边大于第三边

2.注意不要用sqrt函数,因为输出的是面积的平方,最后直接输出即可,用sqrt函数时可能有的数据不是平方数,开放后会有精度损失,导致一直无法AC

AC_Code:C++

#include <iostream>
using namespace std;typedef long long LL;int main()
{LL a,b,c;   cin>>a>>b>>c;if(a+b>c&&a+c>b&&b+c>a){  //任意两边大于第三边LL s=(a+b+c)/2;LL ans=s*(s-a)*(s-b)*(s-c);cout<<ans<<endl;}else cout<<-1<<endl;return 0;
}

AC_Code:java

import java.util.Scanner;public class Main {public static void main(String[] args) {Scanner sc = new Scanner(System.in);long a=sc.nextLong(),b=sc.nextLong(),c=sc.nextLong();if(a+b>c&&a+c>b&&b+c>a){ //任意两边大于第三边long s=(a+b+c)/2;long ans=s*(s-a)*(s-b)*(s-c);System.out.println(ans);}else System.out.println(-1);}
}

题目三:压缩矩阵【算法赛】

压缩矩阵【算法赛】 - 蓝桥云课 (lanqiao.cn)

思路:找规律/数学

1.第一行和最后一行是两个数,其他行都是三个数

2.先算出行,算出行后让列也等于行,用x模3看余数是几,看是需要偏移,余数为1向右偏移一位,余数为2向左偏移一位,余数为0不需要偏移

3.算行的话就是找规律了,(x+4)/3就是行

AC_Code:C++

#include <iostream>
#include <cstring>
#include <algorithm>
#include <vector>
#include <queue>
#include<stack>
#include<cmath>
#include <unordered_set>
#include <unordered_map>
#include<set>
#include <map>using namespace std;typedef long long LL;
typedef pair<int,int>PII;#define x first
#define y second
#define ls u<<1
#define rs u<<1|1
#define all(ss) ss.begin(),ss.end()int const mod1=998244353;   
int const mod2=1e9+7;
int const N=2e5+7;
int const INF=0x3f3f3f3f;int T;
int m;
int a[N];
string s;void solve(){LL n;scanf("%lld%d", &n, &m);while (m -- ){LL x;scanf("%lld", &x);LL row=(x+4)/3; //计算行LL col=row;//看是否需要向左右偏移if(x%3==2)  col--;else if(x%3==1) col++;printf("%lld %lld\n",row,col);}
} void init(){                     }int main()
{//std::ios::sync_with_stdio(false);   cin.tie(0); cout.tie(0);T=1;//cin>>T;//scanf("%d",&T);init();while(T--){solve();}return 0;
}

AC_Code:java

import java.util.Scanner;public class Main {public static void main(String[] args) {Scanner sc=new Scanner(System.in);long n=sc.nextLong();int q=sc.nextInt();while(q-->0) {long x=sc.nextLong();long row=(x+4)/3; //算出行long col=row;//看是否要向左右偏移if(x%3==1)  col++;else if(x%3==2)  col--;System.out.println(row+" "+col);}}
}

题目四:恒纪元【算法赛】

恒纪元【算法赛】 - 蓝桥云课 (lanqiao.cn)

思路:

1.乱纪元的增长速度是非常快的,(2^40>1e12)所以乱纪元是非常少的,那么可以预处理出所有的乱纪元

2.对于每一个询问s,暴力找到大于s的第一个恒纪元t,再暴力(二分也可以)找到第一个大于t的乱纪元,用第一个大于t的乱纪元-t就是恒纪元可以持续的天数了

3.这个的预处理其实是一个谜(预处理不好很容易只能过25%的测试样例),预处理出小于1e13次方的乱纪元就可以过

AC_Code:C++

#include <iostream>
#include <cstring>
#include <algorithm>
#include <vector>
#include <queue>
#include<stack>
#include<cmath>
#include <unordered_set>
#include <unordered_map>
#include<set>
#include <map>using namespace std;typedef long long LL;
typedef pair<int,int>PII;#define x first
#define y second
#define ls u<<1
#define rs u<<1|1
#define all(ss) ss.begin(),ss.end()int const mod1=998244353;   
int const mod2=1e9+7;
int const N=2e5+7;
LL const INF=1e13;int T;
int n,q;
int x,y,z;
set<LL>vis; //存储乱纪元LL qpow(int a,int b){LL res=1;for(int i=0;i<b;i++){res=res*a;if(res>INF) return -1;  //大于正无穷了}return res;
}void solve(){scanf("%d%d%d",&x,&y,&z);for(int i=0;i<=40;i++){LL a=qpow(x,i);if(a==-1)   break;//大于正无穷了for(int j=0;j<=40;j++){LL b=qpow(y,j);if(b==-1)   break;//大于正无穷了for(int k=0;k<=40;k++){LL c=qpow(z,k);if(c==-1)   break;//大于正无穷了LL s=a+b+c;if(s>INF)   break;  //三者相加大于正无穷vis.insert(s);}}}scanf("%d",&q);while(q--){LL s;   scanf("%lld",&s);   LL t=s+1;while(vis.count(t)) t++;    //找到第一个恒纪元//二分找到第一个大于t的乱纪元,相减求恒纪元持续了多少天printf("%lld %lld\n",t,*vis.upper_bound(t)-t);}
} void init(){                     }int main()
{//std::ios::sync_with_stdio(false);   cin.tie(0); cout.tie(0);T=1;//cin>>T;//scanf("%d",&T);init();while(T--){solve();}return 0;
}

AC_Code:java


import com.sun.source.tree.Tree;import java.util.*;public class Main {static final long INF=(long)1e13;static long qpow(int a,int b){long res=1;for(int i=0;i<b;i++)    {res=res*a;if(res>INF) return -1;}return res;}public static void main(String[] args) {Scanner sc=new Scanner(System.in);TreeSet<Long> vis=new TreeSet<>();List<Long> list=new ArrayList<>();int x=sc.nextInt(),y=sc.nextInt(),z=sc.nextInt();//预处理乱纪元for(int i=0;i<=40;i++){long a=qpow(x,i);if(a==-1)   break; //大于正无穷for(int j=0;j<=40;j++){long b=qpow(y,j);if(b==-1)   break; //大于正无穷for (int k = 0; k < 40; k++) {long c=qpow(z,k);if(c==-1)   break;  //大于正无穷long s=a+b+c;if(s>INF)   break;  //三者相加大于正无穷if(!vis.contains(s)){list.add(s);vis.add(s);}    }}}Collections.sort(list); //集合排序int q=sc.nextInt();while(q-->0){long s=sc.nextLong();long t=s+1;//找到第一个恒纪元while(vis.contains(t))  t++;//找到大于第一个横纪元的乱纪元int idx=-1;for (int i = 0; i < list.size(); i++) {if(list.get(i)>t){idx=i;break;}}//第一个大于t的乱纪元-减去恒纪元System.out.println(t+" "+(list.get(idx)-t));// System.out.println(t+" "+(vis.ceiling(t+1)-t));   //二分}                   //ceiling相当于lower_bound}
}

题目五:充能计划【算法赛】

充能计划【算法赛】 - 蓝桥云课 (lanqiao.cn)

思路:

简述题意:n个引擎,m种宝石,q个询问,每个询问选出一种宝石p,放到第k个引擎上,此时区间[k,min(n,k+s[p]-1)]都会放入p这个宝石,s数组为每个宝石的充能范围,最后问n种引擎宝石的数量

1.对n个引擎开n个set,对每个询问的合法区间都加入宝石p,最后对每个引擎输出set的大小,时间复杂度o(n^2),会tle的,怎么优化呢?

2.可以对每种宝石分组,对每一个询问记录区间,最后对每种宝石合并区间(注意合并区间前要对左端点排序),合并区间后用差分记录左右端点位置

3.最后累加差分,计算答案

AC_Code:C++

#include <iostream>
#include <cstring>
#include <algorithm>
#include <vector>
#include <queue>
#include<stack>
#include<cmath>
#include <unordered_set>
#include <unordered_map>
#include<set>
#include <map>using namespace std;typedef long long LL;
typedef pair<int,int>PII;#define x first
#define y second
#define ls u<<1
#define rs u<<1|1
#define all(ss) ss.begin(),ss.end()int const mod1=998244353;   
int const mod2=1e9+7;
int const N=2e5+7;
int const INF=0x3f3f3f3f;int T;
int n,m,q;
int s[N];
vector<PII>line[N]; //line[i]:存储宝石i的所有区间
int diff[N];void solve(){scanf("%d%d%d", &n, &m,&q);for(int i=1;i<=m;i++)   scanf("%d",s+i);while(q--){int p,k;    scanf("%d%d",&p,&k);line[p].push_back({k,min(n,k+s[p]-1)});}for(int i=1;i<=m;i++){if(line[i].empty()) continue;sort(line[i].begin(),line[i].end());  //按左端点排序int l=line[i][0].x,r=line[i][0].y;//区间合并,差分for(PII p:line[i]){if(r>=p.x)  r=max(r,p.y);else{diff[l]++;diff[r+1]--;l=p.x;r=p.y;}}diff[l]++;  diff[r+1]--;}int ans=0;  //累加查分计算答案for(int i=1;i<=n;i++){ ans+=diff[i];printf("%d ",ans);}} void init(){                     }int main()
{//std::ios::sync_with_stdio(false);   cin.tie(0); cout.tie(0);T=1;//cin>>T;//scanf("%d",&T);init();while(T--){solve();}return 0;
}

AC_Code:java

import com.sun.source.tree.Tree;import java.util.*;public class Main {static int N=(int)1e5+7;static int[] s=new int[N];static List<Line>[] line=new ArrayList[N];static int[] diff=new int[N];public static void main(String[] args) {Scanner sc=new Scanner(System.in);int n=sc.nextInt(),m=sc.nextInt(),q=sc.nextInt();for(int i=1;i<=m;i++)   {s[i]=sc.nextInt();line[i]=new ArrayList<Line>();}while(q-->0){int p=sc.nextInt(),k=sc.nextInt();line[p].add(new Line(k,Math.min(n,k+s[p]-1)));  //按宝石种类分组}for(int i=1;i<=m;i++) {if (line[i].isEmpty()) continue;Collections.sort(line[i]);  //排序//区间合并,差分操作int l = line[i].get(0).l, r = line[i].get(0).r;for (Line p : line[i]) {if (r >= p.l) r = Math.max(r, p.r);else {diff[l]++;diff[r + 1]--;l = p.l;r = p.r;}}diff[l]++;diff[r + 1]--;}int ans=0;  //计算答案for(int i=1;i<=n;i++){ans+=diff[i];System.out.print(ans+" ");}}
}class Line implements Comparable<Line>{int l,r;public Line(int l, int r) {this.l = l;this.r = r;}public int compareTo(Line o) {return l-o.l;}
}

题目六:大风起兮【算法赛】

大风起兮【算法赛】 - 蓝桥云课 (lanqiao.cn)

思路:

1.动态求平均数,可以用两个multiset,一个存放一半较小的数,一个存放一半较大的数

2.对于每一个询问,先删除一个数,再计算中位数

AC_Code:C++

#include <iostream>
#include <cstring>
#include <algorithm>
#include <vector>
#include <queue>
#include<stack>
#include<cmath>
#include <unordered_set>
#include <unordered_map>
#include<set>
#include <map>using namespace std;typedef long long LL;
typedef pair<int,int>PII;#define x first
#define y second
#define ls u<<1
#define rs u<<1|1
#define all(ss) ss.begin(),ss.end()int const mod1=998244353;   
int const mod2=1e9+7;
int const N=2e5+7;
int const INF=0x3f3f3f3f;int T;
int n,m;
int a[N];
string s;void solve(){scanf("%d", &n);vector<int>b;for(int i=1;i<=n;i++)   {scanf("%d",a+i);b.push_back(a[i]);}sort(b.begin(),b.end());multiset<int>mx,mi; //n为奇数,mi多放一个数for(int i=0;i<(n+1)/2;i++)  mi.insert(b[i]);    for(int i=(n+1)/2;i<n;i++)  mx.insert(b[i]);scanf("%d", &m);while(m--){int x;  scanf("%d",&x);if(mi.count(a[x])){ //删除小的数那一堆mi.erase(mi.find(a[x]));if(mx.size()>mi.size()){int temp=*mx.begin();mi.insert(temp);mx.erase(mx.find(temp));}}else{ //删除大的数那一堆mx.erase(mx.find(a[x]));if(mi.size()-mx.size()>1){int temp=*mi.rbegin();mx.insert(temp);mi.erase(mi.find(temp));}}//输出答案if(mi.size()>mx.size()) printf("%.1lf ",*mi.rbegin()*1.0);else printf("%.1lf ",(*mi.rbegin()+*mx.begin())/2.0);}} void init(){                     }int main()
{//std::ios::sync_with_stdio(false);   cin.tie(0); cout.tie(0);T=1;//cin>>T;//scanf("%d",&T);init();while(T--){solve();}return 0;
}

AC_Code:java

题目七:时空追捕【算法赛】

不会写,占时更新,

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.mzph.cn/news/184704.shtml

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

【Web端CAD/CAE文字标注】webgl+canvas 2d实现文字标注功能

一、需求背景 在CAD/CAE领域经常会遇到显示节点编号这种需求&#xff0c;效果如下图&#xff1a; 本文介绍如何在WebGL中实现文字的显示&#xff0c;对于如何在OpenGL中实现请绕路。 二、实现原理 Canvas是HTML5提供的元素&#xff0c;用于在网页上绘制图形&#xff0c;其支…

设计循环队列

目录 设计循环队列 &#x1f642;【1】数组循环队列 思路分析 ❓1 ❓2 ❓3 易错总结 创建MyCircularQueue 初始化myCircularQueueCreate 为空否myCircularQueueIsEmpty 为满否myCircularQueueIsFull 插入元素myCircularQueueEnQueue 删除元素myCircularQueueDeQue…

无醇啤酒行业分析:预计2028年将达到106亿美元

按照国际惯用的标准划分&#xff0c;通常将酒精度3.5%-4%的称为普通啤酒&#xff0c;将酒精度大于0.5%、小于2.5%的称为低醇啤酒&#xff0c;而酒精度小于0.5%便称为无醇啤酒。酒精给人带来的兴奋感&#xff0c;与体育比赛的紧张刺激相辅相成&#xff0c;啤酒也成为了许多球迷们…

基于UDP的网络聊天室

客户端 #include <myhead.h> //定义存储信息结构体 typedef struct _MSG {char code; //操作码&#xff1a;L表示登录C表示群聊S表示系统消息S表示退出char name[128]; char txt[256];}msg_t;//定义保存客户端网络信息的链表 typedef struct _ADDR {struct sockaddr_i…

【elementUI】el-tab相关问题

Tabs 标签页 分隔内容上有关联但属于不同类别的数据集合。 <template><el-tabs v-model"activeName" tab-click"handleClick"><el-tab-pane label"用户管理" name"first">用户管理</el-tab-pane><el-tab-p…

Linux重置MySql密码(简洁版)

关闭验证 /etc/my.cnf-->[mysqld]-->skip-grant-tables 重启MySql service mysql restart 登陆MySql mysql -u root 刷新权限 FLUSH PRIVILEGES; 更新密码 ALTER USER rootlocalhost IDENTIFIED BY 123456; 退出MySql exit 打开验证 /etc/my.cnf-->[mysqld]-->skip…

建设“参与城市”大学--SMU在2023年绿色金融全球论坛上分享观点

2023年11月21日&#xff0c;由新加坡管理大学&#xff08;SMU&#xff0c;简称新大&#xff09;和中国人民大学&#xff08;RUC&#xff0c;简称人大&#xff09;联合主办的“绿色金融与治理&#xff1a;从承诺到行动”全球论坛在北京召开。论坛汇集了来自新加坡、中国及世界各…

SpringBoot项目打成jar包后,上传的静态资源(图片等)如何存储和访问

1.问题描述&#xff1a; 使用springboot开发一个项目&#xff0c;开发文件上传的时候&#xff0c;通常会将上传的文件存储到资源目录下的static里面&#xff0c;然后在本地测试上传文件功能没有问题&#xff0c;但是将项目打成jar包放到服务器上运行的时候就会报错&#xff0c…

P26 C++创建并初始化对象

目录 前言 01 在堆栈上创建对象 02 堆栈上创建对象有什么区别 03 在栈上实例化对象 04 在堆中实例化对象 前言 本章我们讨论一下 C 创建对象的相关问题。 如果你还不了解什么是类&#xff0c;可以点击下文查看 P9 C类-CSDN博客 本章以下主要讲解以下几点 在栈上创建对象…

大数据分析与应用实验任务十

大数据分析与应用实验任务十 实验目的&#xff1a; 通过实验掌握spark SQL的基本编程方法&#xff1b; 熟悉RDD到DataFrame的转化方法&#xff1b; 通过实验熟悉spark SQL管理不同数据源的方法。 实验任务&#xff1a; 进入pyspark实验环境&#xff0c;在桌面环境打开jup…

Linux:docker镜像的创建(5)

1.基于已有镜像创建 步骤&#xff1a; 1.将原始镜像加入容器并运行 2.在原始镜像中部署各种服务 3.退出容器 4.使用下面命令将容器生成新的镜像 现在我们在这个容器里做了一些配置&#xff0c;我们要把他做成自己镜像 docker commit -m "centos7_123" -a "tarr…

20. Matplotlib 数据可视化

目录 1. 简介2. Matplotlib 开发环境2.1 画图2.2 画图接口2.4 线形图2.5 散点图2.6 等高线图2.7 直方图 1. 简介 Matplotlib网址&#xff1a;https://matplotlib.org/ 数据可视化是数据分析中最重要的工作之一。Matploblib是建立在Numpy数组基础上的多平台数据可视化程序库&a…

PostgreSQL 分区表插入数据及报错:子表明明存在却报不存在以及column “xxx“ does not exist 解决方法

PostgreSQL 分区表插入数据及报错&#xff1a;子表明明存在却报不存在以及column “xxx“ does not exist 解决方法 问题1. 分区表需要先创建子表在插入&#xff0c;创建子表立马插入后可能会报错子表不存在&#xff1b;解决&#xff1a; 创建子表及索引后&#xff0c;sleep10毫…

【JavaWeb】会话过滤器监听器

会话&过滤器&监听器 文章目录 会话&过滤器&监听器一、会话1.1 Cookie1.2 Session1.3 三大域对象 二、过滤器三、监听器3.1 application域监听器3.2 session域监听器3.3 request域监听器3.4 session域的两个特殊监听器3.4.1 session绑定监听器3.4.2 钝化活化监听…

医院电子病历编辑器源码(支持云端SaaS服务)

电子病历系统基于云端SaaS服务的方式&#xff0c;采用B/S&#xff08;Browser/Server&#xff09;架构提供&#xff0c;采用前后端分离模式开发和部署。使用用户通过浏览器即能访问&#xff0c;无需关注系统的部署、维护、升级等问题&#xff0c;系统充分考虑了模板化、 配置化…

树与二叉树堆:堆的意义

目录 堆的意义&#xff1a; 第一是堆的排序&#xff0c;第二是堆的top k 排行问题 堆的 top k 排行问题&#xff1a; 面对大量数据的top k 问题&#xff1a; 堆排序的实现&#xff1a;——以升序为例 方法一 交换首尾&#xff1a; 建立大堆&#xff1a; 根结点尾结点的…

express+mySql实现用户注册、登录和身份认证

expressmySql实现用户注册、登录和身份认证 注册 注册时需要对用户密码进行加密入库&#xff0c;提高账户的安全性。用户登录时再将密码以相同的方式进行加密&#xff0c;再与数据库中存储的密码进行比对&#xff0c;相同则表示登录成功。 安装加密依赖包bcryptjs cnpm insta…

CompletableFuture详解

目录 介绍 Future介绍 CompletableFuture介绍 CompletableFuture常用的API介绍 常用的静态方法源码解析 runAsync 源码 案例 结果 supplyAsync 源码 案例 结果 规律 CompletableFuture获取返回值方法介绍 返回值区别 代码演示 返回结果 CompletableFuture其…

【Docker】Swarm内部的负载均衡与VIP

在Docker Swarm中&#xff0c;有两种方式可以实现内部的负载均衡&#xff1a;Service VIP和Routing Mesh。 Service VIP&#xff08;Virtual IP&#xff09;&#xff1a;Service VIP是一种基于VIP的负载均衡方式&#xff0c;它为每个服务分配一个虚拟IP地址。当请求到达Servic…

Word异常退出文档找回怎么操作?4个正确恢复方法!

“刚刚我在用word编辑文档&#xff0c;但是突然word就显示异常了&#xff0c;然后莫名其妙就自动退出了&#xff0c;这可怎么办&#xff1f;我还有机会找回这些文档吗&#xff1f;” 当我们在使用Microsoft Word时&#xff0c;突然遭遇到程序异常退出的情况&#xff0c;可能会让…