蓝桥杯打卡day13(3.16)
目录
- 1.特殊日期
- 2.重合次数
- 3.左移右移
1.特殊日期
package lanqiaobei.exe.day13;
import java.util.Scanner;
public class 特殊日期01 {
static int[] days = {0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int y = 1900;
int m = 1;
int d = 1;
long ans = 0;
while (true) {
if (y == 9999 && m == 12 && d == 31){
break;
}
if (isEqual(y,m,d))ans++;
if (y % 4 == 0 && y % 100 != 0 || y % 400 == 0) {
days[2] = 29;
} else days[2] = 28;
if (d == days[m]) {
d = 1;
if (m == 12) {
m = 1;
y++;
} else m++;
} else d++;
}
System.out.println(ans);
}
static boolean isEqual(int y,int m,int d){
int a = 0;
int b = 0;
while (y!=0){
a += y % 10;
y/=10;
}
while (m!=0){
b += m % 10;
m/=10;
}
while (d!=0){
b += d % 10;
d/=10;
}
return a==b ;
}
}
2.重合次数
public class 重合次数 {
public static void main(String[] args) {
int h = 6;
int m = 13;
int s = 22;
int ans = 0;
while (true){
if(s == m)ans++;
if(h == 14 && m == 36 && s == 20)break;
s++;
if(s == 60){
s = 0;
m++;
if (m == 60){
m = 0;
h++;
}
}
}
System.out.println(ans - 14 + 6);
}
}
3.左移右移
import java.io.*;
import java.util.*;
public class 左移右移 {
static BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
static PrintWriter pr = new PrintWriter(new OutputStreamWriter(System.out));
public static void main(String[] args) throws IOException {
String[] s = br.readLine().trim().split(" ");
int n = Integer.parseInt(s[0]);
int m = Integer.parseInt(s[1]);
Node[] nodes = new Node[n+1];
for (int i = 1; i <= n; i++){
nodes[i] =new Node(i,i);
}
int cnt1 = -1;
int cnt2 = (int) 2e6+1;
for (int i = 0; i < m; i++) {
s = br.readLine().trim().split(" ");
int v = Integer.parseInt(s[1]);
if("L".equals(s[0])){
nodes[v].y = cnt1--;
}
if("R".equals(s[0])){
nodes[v].y = cnt2++;
}
}
Arrays.sort(nodes,1,n+1);
for (int i = 1; i <= n; i++) {
System.out.print(nodes[i].x + " ");
}
}
}
class Node implements Comparable<Node>{
int x;
int y;
public Node(int x,int y){
this.x = x;
this.y = y;
}
@Override
public int compareTo(Node o) {
if (o.y != y)return y - o.y;
return x - o.x;
}
}
相关推荐
JEP30-PX100A PartModel Product Guidelines for Electronic-Device Substrates and Assemblies – XML Requ
JEP30-PX100A PartModel Product Guidelines for Electronic-Device Substrates and Assemblies – XML Requirements
基于Matlab的自动睡眠粒状结构检测算法,从脑电信号中进行。.zip
1.版本:matlab2014a/2019b/2024b 2.附赠案例数据可直接运行。 3.代码特点:参数化编程、参数可方便更改、代码编程思路清晰、注释明细。 4.适用对象:计算机,电子信息工程、数学等专业的大学生课程设计、期末大作业和毕业设计。
JEP375 2.5D_3D Silicon thinned wafers with Through Silicon Vias (TSV’s) and Backside Redistribution
JEP375 2.5D_3D Silicon thinned wafers with Through Silicon Vias (TSV’s) and Backside Redistribution Layer (RDL).pdf
考虑供电可靠性与算力柔性的数据中心园区源‑储‑荷一体化规划研究(Matlab代码实现)
考虑供电可靠性与算力柔性的数据中心园区源‑储‑荷一体化规划研究(Matlab代码实现)内容概要:本文围绕“考虑供电可靠性与算力柔性的数据中心园区源-储-荷一体化规划”展开研究,提出了一种综合能源系统优化规划方法。该方法充分考虑数据中心对供电可靠性的高要求以及算力负载的灵活性特征,将电力供应、储能配置与计算负荷进行协同优化。通过建立数学模型,整合光伏发电、储能系统与数据中心负荷调度,利用Matlab代码实现优化求解,旨在提升能源利用效率、降低运营成本并增强系统韧性。研究涵盖了对新能源出力不确定性、负荷波动以及储能动态行为的建模与仿真分析,最终验证了所提一体化规划方案在提高供电可靠性和实现算力资源柔性调度方面的有效性。; 适合人群:具备一定电气工程、能源系统或计算机科学背景,从事数据中心、智能电网、综合能源系统等相关领域研究的研究生、科研人员及工程技术人员。; 使用场景及目标:① 为数据中心园区的绿色低碳与高可靠运行提供规划设计方案;② 实现可再生能源的高效消纳与储能系统的优化配置;③ 探索算力作为柔性负荷参与电力系统互动的潜力,支撑新型电力系统建设。; 阅读建议:此资源以Matlab代码为核心,辅以理论模型,建议读者在理解基本原理的基础上,动手运行和调试所提供的代码,通过修改参数和场景设置来深入掌握一体化规划的优化逻辑与关键技术细节。
歌曲爆款传播预测数据集10000首曲目Spotify音频特征机器学习
本数据集为合成音乐数据,包含2010至2025年间10000首曲目的Spotify风格音频特征与明确的爆款(viral)目标标签。现有音乐数据集常缺少可用建模目标或存在授权限制,本数据集提供了干净、字段完整、可直接用于监督学习的基准语料。字段涵盖节奏、能量、可舞性、声学度、效价等音频属性,以及曲目元数据与年份信息,目标列viral基于传播表现定义,可直接用于二分类建模。适合开展爆款歌曲预测、音频特征与传播关系分析、年代音乐风格演变可视化、特征重要性排序等分析任务,也可作为分类、回归与特征工程教学的演示数据。数据结构清晰、无缺失值,适合数据科学课程、音乐媒体分析与推荐算法原型验证使用。


