- 博客(132)
- 资源 (1)
- 收藏
- 关注
原创 java int数组转Integer数组及对数组降序
从键盘接受一个长度为n的数组本文第一种方法使用集合时对其泛化,第二种方法则没有有关泛化的知识请读者自行查阅int数组转Integer数组的方法//数组元素转换为数值流 IntStream stream = Arrays.stream(nums); //流中元素全部装箱 Stream<Integer> st = stream.boxed(); //将流转换为数组 Integer[] num = st.toArray(Integer[]::new);1、使用匿名类
2021-04-07 22:52:50 2409
原创 使用openGL,利用多边形填充的扫描线算法画出实心五边形
具体内容参考博客:https://blog.csdn.net/qq_38345598/article/details/84553043实心五边形任意给定5个顶点坐标,利用多边形填充的扫描线算法编写程序,生成一个实心五边形。运行截图代码(转载)#include <GL/glut.h>#include <windows.h>const int POINTNUM = 5;typedef struct XET{ float x; float dx, ymax; XET
2021-03-11 20:22:19 1681
原创 使用openGL,用Bresenham算法画椭圆
运行结果源代码//用Bresenham算法画椭圆#include<iostream>#include<stdlib.h>#include <GL/glut.h>void putpixel(int xc, int yc, int x, int y) { glBegin(GL_POINTS); glVertex3f(xc + x, yc + y, 0); glEnd();}void drawElipse(int xc, int yc, int a,
2021-03-10 20:05:59 1667 1
原创 VS2019配置openGL
1、打开vs2019管理面板点击修改,选择使用c++的桌面开发然后选择单个组件,将代码工具中的这个打钩,然后安装2、下载配置openGL下载链接:https://www.opengl.org/resources/libraries/glut/glutdlls37beta.zip下载解压后如图所示将文件放到对应文件夹(若没有gl文件夹,创建一个即可)把glut.h复制到…\VC\Tools\MSVC\14.16.27023\include\gl下把glut.lib和glut32.lib
2021-03-10 20:03:28 3588 4
原创 JSP基本语法
JSP基本语法<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%><%@ page import = "java.util.Date" %><%@ page import = "java.text.SimpleDateFormat" %><!DOCTYPE html><html><head><
2021-02-02 16:14:44 320
原创 JavaScript基本用法
JavaScript1、主要特点2、JavaScript语言基础注意:a、JavaScript区分大小写,与java相同b、每行结尾的分号可有可无,小编建议在每行结束加上分号,这样可以保证每行代码的准确性c、变量是弱类型的,只使用var运算符,就可以将变量初始化为任意值d、使用大括号标记代码块,与java相同e、单行注释和多行注释,与java相同JavaScript关键字3、数据类型1、整数型采用十进制、八进制、十六进制表示,以0开头的数为八进制数,以0x开头的数为16进制数2
2021-01-28 14:47:36 234
原创 CSS样式表
CSS样式表css规则css选择器CSS选择器常用的是标记选择器、类别选择器、id选择器等标记选择器CSS标记选择器就是声明页面中哪些标记采用CSS样式例:定义a标记选择器,该标记选择器定义超链接的字体与颜色<style> a{ font-size:9px; color:#F93; }</style>类别选择器标记选择器是的页面中的所有相同类型元素的效果都一样,这时候就需要引入类别选择器类别选择器的名称由用户定
2021-01-25 14:48:34 216
原创 html阶段性小结1---简单的登录界面及跳转
学完html的基本标记之后,做一小结,写一个简要的登录页面内容包括表格和表单的使用,以及图片的导入和超链接标记截图:登录(html常用标记.jsp)<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%><!DOCTYPE html><html><head><meta charset="UTF-8"><t
2021-01-20 16:54:01 380
原创 超链接与图片标记
超链接与图片标记超链接标记是页面中非常重要的元素,在网站实现中从一个页面跳转到另一个页面,这个功能就是通过超链接标记完成的格式:<a href = ""></a>属性href用来设定链接到那个页面中图片标记:格式<img src = "uri" width = "value" heigh = "value" border = "value" alt = "提示文字">实例:<table width="409" height="523" bord
2021-01-20 15:11:47 415 3
原创 表格和表单标记
表格标记例子:学生考试成绩单<body><table width="318" height="167" border="1" align="center" bgcolor="red> <caption>学生考试成绩单</caption> <tr> <td align="center" valign="middle">姓名</td> <td align="center" valign="m
2021-01-18 18:02:27 288
原创 HTML常用标记
HTML常用标记换行标记<br>实例:黄鹤楼送孟浩然之广陵<html><head><title>黄鹤楼送孟浩然之广陵</title></head><body><b>黄鹤楼送孟浩然之广陵</b><br>故人西辞黄鹤楼,烟花三月下扬州。<br>孤帆远影碧空尽,唯见长江天际流。</body></html>段落标记以<
2021-01-18 15:10:57 334 1
原创 java初学数据库编程------(最简易的学生管理系统(增删查))
1、 实验目的(1) 掌握基本的DBMS使用(2) 理解JDBC的概念(3) 运用JDBC-ODBC桥开发数据库2、 基本要求(1) 注意自始至终贯彻课程中所介绍程序设计风格,养成良好的编程习惯(2) 独立完成所布置习题(3) 为保证尽量在统一安排的上机时间内编译运行通过程序,应事先设计好程序(4) 认真完成每次试验,并写出试验报告3、 实验内容和步骤完成一个具体的数据库系统的开发,如图书管理系统、人事管理系统、学生信息管理系统等等。源代码package studentManagem
2020-12-12 13:52:14 257
原创 Codeforces Round #688 (Div. 2) ------ Cancel the Trains
题目Gildong’s town has a train system that has 100 trains that travel from the bottom end to the top end and 100 trains that travel from the left end to the right end. The trains starting from each side are numbered from 1 to 100, respectively, and all trai
2020-12-05 09:48:12 507
原创 Educational Codeforces Round 99------Sequence and Swaps
题目You are given a sequence a consisting of n integers a1,a2,…,an, and an integer x. Your task is to make the sequence a sorted (it is considered sorted if the condition a1≤a2≤a3≤⋯≤an holds).To make the sequence sorted, you may perform the following opera
2020-12-01 17:20:05 155
原创 字节数组与int类型之间的转换
int占4个字节,一个字节8位java中的byte是有符号的,范围是-128~127将int转换为长度为4的字节数组import java.util.Arrays;import java.util.Scanner;public class IntConversionByte { public static byte[] conversion(int n){ byte[] a = new byte[4]; for(int i = 0; i < 4; i+
2020-12-01 16:23:25 1458
原创 Educational Codeforces Round 99 ------ Ping-pong
题意Alice and Bob play ping-pong with simplified rules.During the game, the player serving the ball commences a play. The server strikes the ball then the receiver makes a return by hitting the ball back. Thereafter, the server and receiver must alternatel
2020-12-01 14:23:40 279
原创 Educational Codeforces Round 99 (Rated for Div. 2)------Jumps
题目You are standing on the OX-axis at point 0 and you want to move to an integer point x>0.You can make several jumps. Suppose you’re currently at point y (y may be negative) and jump for the k-th time. You can:either jump to the point y+kor jump to
2020-12-01 14:00:24 175
原创 Educational Codeforces Round 99 ------Strange Functions
题目Let’s define a function f(x) (x is a positive integer) as follows: write all digits of the decimal representation of x backwards, then get rid of the leading zeroes. For example, f(321)=123, f(120)=21, f(1000000)=1, f(111)=111.Let’s define another func
2020-12-01 13:27:15 193
原创 Codeforces Round #685 (Div. 2)------Non-Substring Subsequence
题目Hr0d1y has q queries on a binary string s of length n. A binary string is a string containing only characters ‘0’ and ‘1’.A query is described by a pair of integers li, ri (1≤li<ri≤n).For each query, he has to determine whether there exists a good
2020-11-28 09:18:47 181
原创 Codeforces Round #685 (Div. 2)------Subtract or Divide
题意给定一个数n,问让这个数从n到1需要几步操作。有以下两种操作方式:1、如果n > 1,n可以减12、除以一个能整除的数题解想一下就可以发现,除了1,2,3这三个数是特殊情况之外,其他的只有奇数和偶数,对于偶数,除以一个数,让它变为2,再减一,需要2步;对于奇数,先将它减一变成偶数,按偶数操作即可,需要3步AC代码#include<iostream>#include<algorithm>#include<queue>#include<ve
2020-11-28 08:27:11 142
原创 Java输入输出流
要求1保存对象信息到文件,并将文件中的对象信息显示出来。代码此处对象为一个学生对象import java.io.*;class Student implements Serializable{ String number, name; public String getNumber() { return number; } public void setNumber(String number) { this.number = nu
2020-11-26 20:05:15 137
原创 Java面向对象实验------打怪兽(打妖怪)
题目角色可向怪物实施攻击,一次攻击后,怪物会损失部分生命值,当生命值损失完之后,怪物死亡需求角色可装备不同的武器,目前有木剑、铁剑、魔剑三种木剑攻击,生命值-20铁剑攻击,生命值-50魔剑攻击,生命值-100代码攻击接口package fightMonsters;interface Attack { void lossBlood(Monster m); int getHu();}木剑package fightMonsters;public class Wo
2020-11-23 20:05:36 1841 1
原创 Educational Codeforces Round 98 (Rated for Div. 2)------Radio Towers
题目There are n+2 towns located on a coordinate line, numbered from 0 to n+1. The i-th town is located at the point i.You build a radio tower in each of the towns 1,2,…,n with probability 12 (these events are independent). After that, you want to set the s
2020-11-21 10:24:44 154
原创 Educational Codeforces Round 98 (Rated for Div. 2)------Two Brackets
题目You are given a string s, consisting of brackets of two types: ‘(’, ‘)’, ‘[’ and ‘]’.A string is called a regular bracket sequence (RBS) if it’s of one of the following types:empty string;‘(’ + RBS + ‘)’;‘[’ + RBS + ‘]’;RBS + RBS.where plus is a c
2020-11-21 09:38:19 120
原创 Educational Codeforces Round 98 (Rated for Div. 2)------Toy Blocks
题目You are asked to watch your nephew who likes to play with toy blocks in a strange way.He has n boxes and the i-th box has ai blocks. His game consists of two steps:he chooses an arbitrary box i;he tries to move all blocks from the i-th box to other b
2020-11-21 09:30:18 241
原创 Educational Codeforces Round 98 (Rated for Div. 2)------Robot Program
题目There is an infinite 2-dimensional grid. The robot stands in cell (0,0) and wants to reach cell (x,y). Here is a list of possible commands the robot can execute:move north from cell (i,j) to (i,j+1);move east from cell (i,j) to (i+1,j);move south fro
2020-11-21 08:29:37 153
原创 牛客小白月赛29(签到:A、E、G、H)
A贪心,由于基地可以重复销毁,所以找出找出每架战机可轰炸基地的最大价值,排序之后贪心找一下即可#include<iostream>#include<algorithm>using namespace std;const int N = 1e6 + 15;struct node{ int d, v;}no[N];bool cmp(node a, node b){ if(a.d == b.d) return a.v < b.v;
2020-11-15 08:31:29 197
原创 Codeforces Round #672 (Div. 2)------Cubes Sorting
题目Wheatley decided to try to make a test chamber. He made a nice test chamber, but there was only one detail absent — cubes.For completing the chamber Wheatley needs n cubes. i-th cube has a volume ai.Wheatley has to place cubes in such a way that they
2020-11-10 14:34:29 104
原创 Educational Codeforces Round 97 (Rated for Div. 2)------Reverse Binary Strings
题目题意给你一个01字符串,可以对其中的一段进行翻转操作,问使字符串变成01交错的字符串至少需要多少次操作题解翻转字符串不会改变翻转区间内的01关系,只会改变头和尾的关系,交换找到相邻的相同的作为头,然后往后找第一个相邻的相同的且与头不相同的作为尾翻转第一种思想属于暴利,复杂度有点高,会被卡超时,因此介绍第二种思想第二种思想,多出来的连续的0或1的区间长度之和的最大值AC代码...
2020-11-07 09:44:17 125
原创 Educational Codeforces Round 97 (Rated for Div. 2)------Marketing Scheme
题目题意给定一个区间【l, r】,找出是否存在一个数a使得区间内所有数x满足x % a >= a / 2题解如果2 * l > r 即满足题意AC代码#include<stdio.h>int main(){ int t; scanf("%d", &t); while(t--){ int l, r; scanf("%d%d", &l, &r); if(2 * l > r)
2020-11-07 08:23:04 159
原创 Codeforces Round #681------The Delivery Dilemma
题目Petya is preparing for his birthday. He decided that there would be n different dishes on the dinner table, numbered from 1 to n. Since Petya doesn’t like to cook, he wants to order these dishes in restaurants.Unfortunately, all dishes are prepared in
2020-11-04 19:41:49 175
原创 Codeforces Round #681------Saving the City
题目Bertown is a city with n buildings in a straight line.The city’s security service discovered that some buildings were mined. A map was compiled, which is a string of length n, where the i-th character is “1” if there is a mine under the building number
2020-11-04 19:15:46 172
原创 Codeforces Round #681------Kids Seating
题目:Today the kindergarten has a new group of n kids who need to be seated at the dinner table. The chairs at the table are numbered from 1 to 4n. Two kids can’t sit on the same chair. It is known that two kids who sit on chairs with numbers a and b (a≠b)
2020-11-04 18:58:45 231
原创 Codeforces Round #678 (Div. 2)------Binary Search
题目Andrey thinks he is truly a successful developer, but in reality he didn’t know about the binary search algorithm until recently. After reading some literature Andrey understood that this algorithm allows to quickly find a certain number x in an array.
2020-10-31 10:25:00 226
原创 Codeforces Round #678 (Div. 2)------Prime Square
题目Sasha likes investigating different math objects, for example, magic squares. But Sasha understands that magic squares have already been studied by hundreds of people, so he sees no sense of studying them further. Instead, he invented his own type of sq
2020-10-31 08:50:01 227
原创 Codeforces Round #678 (Div. 2)------Reorder
题目For a given array a consisting of n integers and a given integer m find if it is possible to reorder elements of the array a in such a way thatIt is forbidden to delete elements as well as insert new elements. Please note that no rounding occurs during
2020-10-31 08:23:10 102
原创 生产者消费者问题(java多线程)
实验内容(1)设置存放产品的缓冲区的个数为6个。(2)信号量机制实现生产者和消费者对缓冲区的互斥访问。(3)生产者生产产品时,要输出当前缓冲区冲产品的个数和存放产品的位置。(4)消费者消费产品时,要输出当前缓冲区冲产品的个数和消费产品的位置。(5)用多线程的并发实现生产者进程和消费者进程的同步。实验原理为了使生产者进程和消费之进程能并发执行,在两者之间设置了一个具有n个缓冲区的缓冲池,生产者进程将其所生产的产品放入一个缓冲区中;消费者进程可以从一个缓冲区中取走产品去消费。假定在生产者和消费者
2020-10-22 17:06:33 834
原创 2020牛客国庆集训派对day2(A,C,D,E,F,G,H,J,)
A、AKU NEGARAKU约瑟夫环裸题AC代码#include<iostream>#include<stdio.h>using namespace std;#define ll long longll yuesefu(ll n, ll m) { if (n == 1) { return 0; } else { return (yuesefu(n - 1, m) + m) % n; }}int mai
2020-10-03 10:04:24 314
原创 2020牛客国庆集训派对day1 ------ ABB(马拉车裸题 + 条件判断)
题目Fernando was hired by the University of Waterloo to finish a development project the university started some time ago. Outside the campus, the university wanted to build its representative bungalow street for important foreign visitors and collaborators
2020-10-03 09:42:00 767
原创 蓝桥杯算法训练 ------ Two k-Convex Polygons
题目给定n个棍子的长度和整数k,求能否在其中选出2k个棍子拼成两个凸多边形。使得两个凸多边形都恰好有k跟棍子组成,且任意相邻的边都不共线。输入第一行包括两个正整数n,k,表示棍子总数和多边形边数。第二行包括n个正整数,表示每根棍子的长度。输出第一行输出一个单词Yes或者No表示是否能选出满足要求的2k个棍子。如果第一行输出的是Yes,则第二行要输出方案。输入的棍子从1开始按照输入顺序编号,你需要输出2k个空格隔开的正整数,前k个表示组成第一个凸多边形的棍子的编号,后k个表示组成第二个凸多边形棍
2020-10-02 10:48:02 712 1
第一章(概述).pdf
2020-02-25
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人