国内做网站哪家公司好/广告网站留电话不用验证码

国内做网站哪家公司好,广告网站留电话不用验证码,免费的ppt网站,益阳市人民政府门户网站目录 题目地址 做题情况 A 题 B 题 C 题 D 题 E 题 F 题 牛客竞赛主页 题目地址 牛客竞赛_ACM/NOI/CSP/CCPC/ICPC算法编程高难度练习赛_牛客竞赛OJ 做题情况 A 题 判断字符串第一个字符和第三个字符是否相等 import java.io.*; import java.math.*; import java.u…

目录

题目地址

做题情况

A 题

B 题

C 题

D 题

E 题

F 题

牛客竞赛主页

题目地址

牛客竞赛_ACM/NOI/CSP/CCPC/ICPC算法编程高难度练习赛_牛客竞赛OJ

做题情况

A 题

判断字符串第一个字符和第三个字符是否相等

import java.io.*;
import java.math.*;
import java.util.*;public class Main {static IOS sc=new IOS();static final int MOD = 998244353;public static void solve() throws IOException {String str=sc.next();if(str.charAt(0)==str.charAt(2)) {dduoln("YES");}else {dduoln("NO");}}public static void main(String[] args) throws Exception {int t = 1;
//         t = sc.nextInt();while (t-- > 0) {solve();}}static <T> void dduo(T t) {System.out.print(t);}static <T> void dduoln(T t) {System.out.println(t);}}class IOS{BufferedReader bf;StringTokenizer st;BufferedWriter bw;public IOS(){bf=new BufferedReader(new InputStreamReader(System.in));st=new StringTokenizer("");bw=new BufferedWriter(new OutputStreamWriter(System.out));}public String nextLine() throws IOException{return bf.readLine();}public String next() throws IOException{while(!st.hasMoreTokens()){st=new StringTokenizer(bf.readLine());}return st.nextToken();}public char nextChar() throws IOException{return next().charAt(0);}public int nextInt() throws IOException{return Integer.parseInt(next());}public long nextLong() throws IOException{return Long.parseLong(next());}public double nextDouble() throws IOException{return Double.parseDouble(next());}public float nextFloat() throws IOException{return Float.parseFloat(next());}public BigInteger nextBigInteger() throws IOException{return new BigInteger(next());}public BigDecimal nextDecimal() throws IOException{return new BigDecimal(next());}
}

B 题

找是否出现相同元素

将元素放到 TreeSet 集合 里面

import java.io.*;
import java.math.*;
import java.util.*;public class Main {static IOS sc=new IOS();static final int MOD = 998244353;public static void solve() throws IOException {int n=sc.nextInt();TreeSet<Integer>ts=new TreeSet<>();for(int i=0;i<n;i++) {int a=sc.nextInt();ts.add(a);}if(ts.size()!=n) {dduoln("NO");return;}dduoln("YES");}public static void main(String[] args) throws Exception {int t = 1;
//        t = sc.nextInt();while (t-- > 0) {solve();}}static <T> void dduo(T t) {System.out.print(t);}static <T> void dduoln(T t) {System.out.println(t);}}class IOS{BufferedReader bf;StringTokenizer st;BufferedWriter bw;public IOS(){bf=new BufferedReader(new InputStreamReader(System.in));st=new StringTokenizer("");bw=new BufferedWriter(new OutputStreamWriter(System.out));}public String nextLine() throws IOException{return bf.readLine();}public String next() throws IOException{while(!st.hasMoreTokens()){st=new StringTokenizer(bf.readLine());}return st.nextToken();}public char nextChar() throws IOException{return next().charAt(0);}public int nextInt() throws IOException{return Integer.parseInt(next());}public long nextLong() throws IOException{return Long.parseLong(next());}public double nextDouble() throws IOException{return Double.parseDouble(next());}public float nextFloat() throws IOException{return Float.parseFloat(next());}public BigInteger nextBigInteger() throws IOException{return new BigInteger(next());}public BigDecimal nextDecimal() throws IOException{return new BigDecimal(next());}
}

C 题

在 B 题的基础上进行结构体排序

按照索引大小的规则来排序元素

import java.io.*;
import java.math.*;
import java.util.*;public class Main {static IOS sc=new IOS();static final int MOD = 998244353;public static void solve() throws IOException {int n=sc.nextInt();ArrayList<int[]>l=new ArrayList<>();TreeSet<Integer>ts=new TreeSet<>();for(int i=0;i<n;i++) {int a=sc.nextInt();ts.add(a);l.add(new int[] {i+1,a});}if(ts.size()!=n) {dduoln("NO");return;}dduoln("YES");Collections.sort(l,(a,b) -> {return a[1]-b[1];});for(int p[]:l) {dduo(p[0]+" ");}}public static void main(String[] args) throws Exception {int t = 1;
//        t = sc.nextInt();while (t-- > 0) {solve();}}static <T> void dduo(T t) {System.out.print(t);}static <T> void dduoln(T t) {System.out.println(t);}}class IOS{BufferedReader bf;StringTokenizer st;BufferedWriter bw;public IOS(){bf=new BufferedReader(new InputStreamReader(System.in));st=new StringTokenizer("");bw=new BufferedWriter(new OutputStreamWriter(System.out));}public String nextLine() throws IOException{return bf.readLine();}public String next() throws IOException{while(!st.hasMoreTokens()){st=new StringTokenizer(bf.readLine());}return st.nextToken();}public char nextChar() throws IOException{return next().charAt(0);}public int nextInt() throws IOException{return Integer.parseInt(next());}public long nextLong() throws IOException{return Long.parseLong(next());}public double nextDouble() throws IOException{return Double.parseDouble(next());}public float nextFloat() throws IOException{return Float.parseFloat(next());}public BigInteger nextBigInteger() throws IOException{return new BigInteger(next());}public BigDecimal nextDecimal() throws IOException{return new BigDecimal(next());}
}

D 题

首先找规律

我们发现给出的元素只能是递减的

最后一个元素只能是 1

之后我们可以确定的是

如果一个元素与前面这个元素不同 这个数就是确定的 而后面跟这个数相同的数就都是不确定的

我们只需要统计这段重复的数字和可以填入的数字的排列组合就行

其中可选的数是 排列的最大值n - 比重复数字小的数(不能填) -前面有多少数 (注意要把重复的数空下来)

重复的数我们计数出来的

然后组合数 Anm

import java.io.*;
import java.math.*;
import java.util.*;public class Main {static IOS sc=new IOS();static final int MOD = 998244353;public static void solve() throws IOException {int n=sc.nextInt();long arr[]=new long[n];for(int i=0;i<n;i++) {arr[i]=sc.nextLong();}long ans=arr[0];long cnt=1;long a=0; // 重复的数for(int i=1;i<n;i++) {if(arr[i]>ans) {dduoln("0");return;}if(arr[i]==ans) {a++;}if(arr[i]<ans) {long b= (n-arr[i-1]) -(i-a) +1; // 可选的数if(b<a) {dduoln("0");return;}else if(a!=0&&b!=0){for(long j=b;j>=b-a+1;j--) {cnt*=j;cnt%=MOD;}}ans=arr[i];a=0;}}if(ans!=1) {dduoln("0");return;}for(int i=1;i<=a;i++) {cnt*=i;cnt%=MOD;}dduoln(cnt);}public static void main(String[] args) throws Exception {int t = 1;t = sc.nextInt();while (t-- > 0) {solve();}}static <T> void dduo(T t) {System.out.print(t);}static <T> void dduoln(T t) {System.out.println(t);}}class IOS{BufferedReader bf;StringTokenizer st;BufferedWriter bw;public IOS(){bf=new BufferedReader(new InputStreamReader(System.in));st=new StringTokenizer("");bw=new BufferedWriter(new OutputStreamWriter(System.out));}public String nextLine() throws IOException{return bf.readLine();}public String next() throws IOException{while(!st.hasMoreTokens()){st=new StringTokenizer(bf.readLine());}return st.nextToken();}public char nextChar() throws IOException{return next().charAt(0);}public int nextInt() throws IOException{return Integer.parseInt(next());}public long nextLong() throws IOException{return Long.parseLong(next());}public double nextDouble() throws IOException{return Double.parseDouble(next());}public float nextFloat() throws IOException{return Float.parseFloat(next());}public BigInteger nextBigInteger() throws IOException{return new BigInteger(next());}public BigDecimal nextDecimal() throws IOException{return new BigDecimal(next());}
}

E 题

使用优先队列来维护状态

优先队列采用的是大顶堆(数值大的元素优先级高)

通过优先队列给数组赋值

对于数组 a 我们维护一个数组

数组的索引i 的值表示的是前 i 个元素最小的 m 个数的和

通过优先队列筛选出前 i 个元素数值大的元素并进行移除

数组 b 反向操作就行

最后跑一遍 n 更新最大值

import java.io.*;
import java.math.*;
import java.util.*;public class Main {static IOS sc=new IOS();static final int MOD = 998244353;public static void solve() throws IOException {int n = sc.nextInt();int m = sc.nextInt();long[] a = new long[n+1];long[] b = new long[n+1];long[] pre = new long[n+1];long[] suf = new long[n+1];for (int i = 1; i <= n; i++) {a[i] = sc.nextLong();}for (int i = 1; i <= n; i++) {b[i] = sc.nextLong();}PriorityQueue<Long> q1 = new PriorityQueue<>(Collections.reverseOrder());long sum1 = 0;for (int i = 1; i <= n; i++) {q1.add(a[i]);sum1 += a[i];if (q1.size() > m) {sum1 -= q1.poll();}if (q1.size() == m) {pre[i] = sum1;}}PriorityQueue<Long> q2 = new PriorityQueue<>(Collections.reverseOrder());long sum2 = 0;for (int i = n; i >= 1; i--) {q2.add(b[i]);sum2 += b[i];if (q2.size() > m) {sum2 -= q2.poll();}if (q2.size() == m) {suf[i] = sum2;}}long ans = Long.MAX_VALUE;for (int k = m; k <= n - m; k++) {ans = Math.min(ans, pre[k] + suf[k + 1]);}dduoln(ans);}public static void main(String[] args) throws Exception {int t = 1;
//        t = sc.nextInt();while (t-- > 0) {solve();}}static <T> void dduo(T t) {System.out.print(t);}static <T> void dduoln(T t) {System.out.println(t);}}class IOS{BufferedReader bf;StringTokenizer st;BufferedWriter bw;public IOS(){bf=new BufferedReader(new InputStreamReader(System.in));st=new StringTokenizer("");bw=new BufferedWriter(new OutputStreamWriter(System.out));}public String nextLine() throws IOException{return bf.readLine();}public String next() throws IOException{while(!st.hasMoreTokens()){st=new StringTokenizer(bf.readLine());}return st.nextToken();}public char nextChar() throws IOException{return next().charAt(0);}public int nextInt() throws IOException{return Integer.parseInt(next());}public long nextLong() throws IOException{return Long.parseLong(next());}public double nextDouble() throws IOException{return Double.parseDouble(next());}public float nextFloat() throws IOException{return Float.parseFloat(next());}public BigInteger nextBigInteger() throws IOException{return new BigInteger(next());}public BigDecimal nextDecimal() throws IOException{return new BigDecimal(next());}
}

F 题

相邻的两个数不能一样

import java.io.*;
import java.math.*;
import java.util.*;public class Main {static IOS sc=new IOS();static final int MOD = 998244353;public static void solve() throws IOException {int n = sc.nextInt();ArrayList<Integer> a = new ArrayList<>();a.add(1);int j = 2; 	// 种类数while (a.size() < n) {a.add(j);j++;int nn = a.size();for (int i = 0; i < nn - 1; i++) {a.add(a.get(i));}}System.out.println(j - 1);for (int i = 0; i < n; i++) {System.out.print(a.get(i) + " ");}}public static void main(String[] args) throws Exception {int t = 1;
//        t = sc.nextInt();while (t-- > 0) {solve();}}static <T> void dduo(T t) {System.out.print(t);}static <T> void dduoln(T t) {System.out.println(t);}}class IOS{BufferedReader bf;StringTokenizer st;BufferedWriter bw;public IOS(){bf=new BufferedReader(new InputStreamReader(System.in));st=new StringTokenizer("");bw=new BufferedWriter(new OutputStreamWriter(System.out));}public String nextLine() throws IOException{return bf.readLine();}public String next() throws IOException{while(!st.hasMoreTokens()){st=new StringTokenizer(bf.readLine());}return st.nextToken();}public char nextChar() throws IOException{return next().charAt(0);}public int nextInt() throws IOException{return Integer.parseInt(next());}public long nextLong() throws IOException{return Long.parseLong(next());}public double nextDouble() throws IOException{return Double.parseDouble(next());}public float nextFloat() throws IOException{return Float.parseFloat(next());}public BigInteger nextBigInteger() throws IOException{return new BigInteger(next());}public BigDecimal nextDecimal() throws IOException{return new BigDecimal(next());}
}

牛客竞赛主页

她说喜欢是装的的比赛主页

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

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

相关文章

基金 word-->pdf图片模糊的解决方法

1. 首先需要Adobe或福昕等pdf阅读器。 2. word中 [文件]--[打印]&#xff0c;其中打印机选择pdf阅读器&#xff0c;例如此处我选择福昕阅读器。 3. 选择 [打印机属性]--[编辑]--[图像]&#xff0c;将所有的采样、压缩均设置为 关闭。点击[另存为]&#xff0c;保存为 基金报告…

基于RKNN的嵌入式深度学习开发(2)

上一个章节我们介绍的RKNN模型的模型转换和模型的推理&#xff0c;这一章节我们将介绍模型的量化和评估部分。 2.3 RKNN模型的量化 量化就是将浮点转换为定点运算的过程&#xff0c;或者训练后由rknn来量化。量化模型使用较低精度&#xff08;如int8/uint8/int16&#xff09;保…

Qt 中signals和slots、Q_SIGNAL和Q_LOT、Q_SIGNALS和Q_SLOTS的区别和使用

Qt 中signals和slots、Q_SIGNAL和Q_SLOT、Q_SIGNALS和Q_SLOTS的区别和使用 1.signals和slots 信号和槽函数需要在类的声明中明确声明。信号需要使用signals关键字&#xff0c;而槽函数可以使用slots关键字&#xff08;虽然在现代Qt中&#xff0c;槽函数也可以直接作为普通成员…

【极客时间】浏览器工作原理与实践-2 宏观视角下的浏览器- 2.1 Chrome架构:仅仅打开了1个页面,为什么有4个进程?

https://time.geekbang.org/column/article/113513 2.1 Chrome架构&#xff1a;仅仅打开了1个页面&#xff0c;为什么有4个进程&#xff1f; 前置&#xff1a;基于Chrome浏览器学习浏览器的工作原理 原因&#xff1a; 因为 Chrome、微软的 Edge 以及国内的大部分主流浏览器…

智能图像处理平台:图像处理配置类

这里我们先修改一下依赖&#xff0c;不用JavaCV&#xff0c;用openCV。 导入依赖&#xff1a; <!-- JavaCV 依赖&#xff0c;用于图像和视频处理 --> <!-- <dependency>--> <!-- <groupId>org.bytedeco</groupId>--> &l…

【Python 初级函数详解】—— 参数沙漠与作用域丛林的求生指南

欢迎来到ZyyOvO的博客✨&#xff0c;一个关于探索技术的角落&#xff0c;记录学习的点滴&#x1f4d6;&#xff0c;分享实用的技巧&#x1f6e0;️&#xff0c;偶尔还有一些奇思妙想&#x1f4a1; 本文由ZyyOvO原创✍️&#xff0c;感谢支持❤️&#xff01;请尊重原创&#x1…

夜天之书 #106 Apache 软件基金会如何投票选举?

近期若干开源组织进行换届选举。在此期间&#xff0c;拥有投票权的成员往往会热烈讨论&#xff0c;提名新成员候选人和治理团队的候选人。虽然讨论是容易进行的&#xff0c;但是实际的投票流程和运作方式&#xff0c;在一个成员众多的组织中&#xff0c;可能会有不少成员并不清…

DeepSeek开源周 Day04:从DualPipe聊聊大模型分布式训练的并行策略

DualPipe简介 今天是DeepSeek开源周的第四天&#xff0c;官方开源了一种新型并行计算优化策略——DualPipe。 其实大家阅读过Deepseek-V3技术报告的同学&#xff0c;对这个技术并不陌生。 开源地址&#xff1a;https://github.com/deepseek-ai/DualPipe 核心亮点 DualPipe&…

React:B站评论demo,实现列表渲染、删除按钮显示和功能实现、导航栏渲染切换及高亮显示、评论区的排序

功能要求&#xff1a; 1、渲染评论列表 2、删除评论功能&#xff1a;只显示自己评论的删除按钮&#xff1b;点击删除按钮&#xff0c;删除当前评论&#xff0c;列表中不再显示。 3、渲染导航Tab&#xff08;最新 | 最热&#xff09;和其 高亮实现 4、评论排序功能实现&…

一文了解:部署 Deepseek 各版本的硬件要求

很多朋友在咨询关于 DeepSeek 模型部署所需硬件资源的需求&#xff0c;最近自己实践了一部分&#xff0c;部分信息是通过各渠道收集整理&#xff0c;so 仅供参考。 言归正转&#xff0c;大家都知道&#xff0c;DeepSeek 模型的性能在很大程度上取决于它运行的硬件。我们先看一下…

C#贪心算法

贪心算法&#xff1a;生活与代码中的 “最优选择大师” 在生活里&#xff0c;我们常常面临各种选择&#xff0c;都希望能做出最有利的决策。比如在超市大促销时&#xff0c;面对琳琅满目的商品&#xff0c;你总想用有限的预算买到价值最高的东西。贪心算法&#xff0c;就像是一…

【JAVA SE基础】抽象类和接口

目录 一、前言 二、抽象类 2.1 抽象类的概念 2.2 抽象类语法 2.3 抽象类特性 2.4 抽象类的作用 三、接口 3.1 什么是接口 3.2 语法规则 3.3 接口使用 3.4 接口特性 3.5 实现多接口 3.6 接口间的继承 四、Object类 4.1 获取对象信息&#xff08; toString() &…

查找Excel包含关键字的行(の几种简单快速方法)

需求&#xff1a;数据在后缀为xlsx的Excel的sheet1中且量比较大&#xff0c;比如几十万行几百列&#xff1b;想查找一个关键字所在的行,比如"全网首发"&#xff1b; 情况①知道关键字在哪一列 情况②不确定在哪一列&#xff0c;很多列相似又不同&#xff0c;本文演…

网络运维学习笔记(DeepSeek优化版)009网工初级(HCIA-Datacom与CCNA-EI)路由理论基础与静态路由

文章目录 路由理论基础核心概念路由表六要素路由选路原则加表规则选路优先级 协议与参数常见协议号路由协议优先级对比 网络架构基础AS&#xff08;autonomous system&#xff0c;自治系统&#xff09;路由分类 静态路由(static routing)实验拓扑思科配置示例华为配置示例 典型…

Python 绘制迷宫游戏,自带最优解路线

1、需要安装pygame 2、上下左右移动&#xff0c;空格实现物体所在位置到终点的路线&#xff0c;会有虚线绘制。 import pygame import random import math# 迷宫单元格类 class Cell:def __init__(self, x, y):self.x xself.y yself.walls {top: True, right: True, botto…

基于Springboot博物馆文博资源库系统【附源码】

基于Springboot博物馆文博资源库系统 效果如下&#xff1a; 系统登陆页面 文物信息管理页面 流动申请页面 文物报修页面 个人信息页面 文物保修管理页面 系统主页面 文物类型页面 研究背景 随着信息技术的飞速发展&#xff0c;博物馆文博资源的管理与利用日益受到重视。传统…

【考试大纲】初级信息系统运行管理员考试大纲

目录 引言一、考试要求1、 考试说明2、 考试要求3、 本考试设置的科目包括:二、考试范围考试科目1:信息系统基础知识(初级)考试科目2:信息系统运行管理(应用技术)引言 最新的信息系统运行管理员考试大纲出版于 2018 年 9 月,本考试大纲基于此版本整理。 一、考试要求…

基于单片机的智能扫地机器人

1 电路设计 1.1 电源电路 本电源采用两块LM7805作为稳压电源&#xff0c;一块为控制电路和传感器电路供电&#xff0c;另一块单独为电机供电。分开供电这样做的好处&#xff0c;有利于减小干扰&#xff0c;提高系统稳定性。 LM7805是常用的三端稳压器件&#xff0c;顾名思义0…

传输层协议TCP

TCP全称为 传输控制协议(Transmission Control Protocol)&#xff0c;就是要对数据的传输进行一个详细的控制。 TCP协议段格式 源端口&#xff1a;发送方的端口号&#xff0c;用来标识发送端的应用程序或进程。 目标端口&#xff1a;接收方的端口号&#xff0c;用来标识接收端…

ST-LINK端口连接失败,启动GDB server失败的问题处理方法,有效

目录 1. 问题描述2. 解决办法2.1 后台关闭2.2 后台关闭无法找到ST进程或者关闭后未解决 1. 问题描述 报错&#xff1a; Failed to bind to port 61235, error code -1: No error Failure starting SWV server on TCP port: 61235 Failed to bind to port 61234, error code -1…