- 博客(37)
- 收藏
- 关注
原创 面向对象程序设计(java)课堂代码
HelloProj1HelloWorld.javapackage com.study.hello;public class HelloWorld1 { public static void main(String[] args) { // TODO Auto-generated method stub System.out.println("Hello, Java World!\n"+ "tql" ); //换行输出+字符串连接‘+’ } }HelloProj
2020-09-22 17:27:10 1099
原创 安装Anaconda 全过程
一、下载安装包链接地址:官方个人版二、安装过程这里是我已经装了python的环境了,在做下面的操作,其他情况并没有尝试。之后一直next,最后finish三、打开启动今天老师教过的Notebook完成...
2021-05-19 12:17:32 269
原创 J-codeforce-1430C
题目链接:https://codeforces.com/problemset/problem/1430/C题意从1到n的数,每次选择两个数删除,添加(a+b)/2的操作,使得留下的最后一个数可以最小。注意n=2时输出21 2思路每次选择最后一个数,然后往前选择奇偶性相同的数进行操作。#include"iostream"#include"cstdio"#include"stdlib.h"#include"cstring"#include"cstdlib"#include"vec.
2020-11-16 14:32:24 259
原创 G-HDU1358-Period-KMP
PeriodTime Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 18971 Accepted Submission(s): 8820Problem DescriptionFor each prefix of a given string S with N characters (each character has an ASCII cod
2020-11-16 14:22:10 265 1
原创 E-POJ-3087 Shuffle‘m Up 模拟
Shuffle’m UpTime Limit: 1000MS Memory Limit: 65536KTotal Submissions: 21491 Accepted: 9677DescriptionA common pastime for poker players at a poker table is to shuffle stacks of chips. Shuffling chips is performed by starting with two stacks of poker
2020-11-16 12:46:29 187
原创 D - HDU-2149-博弈
Public SaleTime Limit: 1000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 14368 Accepted Submission(s): 8277Problem Description虽然不想,但是现实总归是现实,Lele始终没有逃过退学的命运,因为他没有拿到奖学金。现在等待他的,就是像FarmJohn一样的农田生涯。要种田得有田才行,Lel
2020-11-16 12:38:22 181
原创 C- POJ -2100 尺取
Graveyard DesignTime Limit: 10000MS Memory Limit: 64000KTotal Submissions: 12631 Accepted: 3215Case Time Limit: 2000MSKing George has recently decided that he would like to have a new design for the royal graveyard. The graveyard must consist of seve
2020-11-16 12:32:12 123
原创 A POJ-1456 Supermarket(并查集+贪心)两种代码实现
SupermarketTime Limit: 2000MS Memory Limit: 65536KTotal Submissions: 25038 Accepted: 11006DescriptionA supermarket has a set Prod of products on sale. It earns a profit px for each product x∈Prod sold by a deadline dx that is measured as an integral
2020-11-16 12:26:05 239
原创 Codeforce Problem 1436C - Binary Search -binary search, combinatorics
C. Binary Searchtime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputAndrey thinks he is truly a successful developer, but in reality he didn’t know about the binary search algorithm until recently. Afte
2020-10-25 10:36:06 290
原创 Codeforce Problem 1436B Square//constructive algorithms, math
B. Prime Squaretime limit per test1.5 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputSasha likes investigating different math objects, for example, magic squares. But Sasha understands that magic squares have already
2020-10-25 10:12:02 182
原创 Codeforce Problem 1436A Recorder 数学
A. Reordertime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputFor 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 t
2020-10-25 10:07:30 208
原创 Fibsieve`s Fantabulous Birthday LightOJ - 1008 数学
Fibsieve had a fantabulous (yes, it’s an actual word) birthday party this year. He had so many gifts that he was actually thinking of not having a party next year.Among these gifts there was an N x N glass chessboard that had a light in each of its cells.
2020-10-22 19:20:23 191
原创 HDU 1079 Calendar Game(博弈SG函数 || 奇偶找规律)
题意:从当前日期,在他/她转的玩家可以移动到下一个历日或下月的同一天。当在之后的一个月中没有在同一天,播放器只能移动到下一个的日历日期。例如,从1924年12月19日,你可以移动到1924年12月20日,下一个日期,或一月19日,1925年,在同一天在下个月。然而,2001年1月31日,你可以只移动2001年2月1日,因为2001年2月31日是无效的。一个球员赢得比赛时,他/她到底到达的日期2001年11月4日。如果一个玩家移动到日期2001年11月4号之后,他/她输了比赛。思路:(2001 , 11
2020-10-22 16:13:47 134
原创 Problem B HDU - 5686 大数斐波那契数列
度熊面前有一个全是由1构成的字符串,被称为全1序列。你可以合并任意相邻的两个1,从而形成一个新的序列。对于给定的一个全1序列,请计算根据以上方法,可以构成多少种不同的序列。Input这里包括多组测试数据,每组测试数据包含一个正整数N,代表全1序列的长度。1≤N≤200Output对于每组测试数据,输出一个整数,代表由题目中所给定的全1序列所能形成的新序列的数量。Sample Input135Sample Output138Hint如果序列是:(111)。可以构造出如下三个新序列
2020-10-12 15:18:54 194
原创 POJ - 3126 -Prime Path 搜索 BFS
The ministers of the cabinet were quite upset by the message from the Chief of Security stating that they would all have to change the four-digit room numbers on their offices.— It is a matter of security to change such things every now and then, to keep
2020-10-10 22:15:42 141
原创 Zoj - 3708 Density of Power Network 水题
The vast power system is the most complicated man-made system and the greatest engineering innovation in the 20th century. The following diagram shows a typical 14 bus power system. In real world, the power system may contains hundreds of buses and thousan
2020-10-10 22:00:33 147
原创 NC14608-after与迷宫(双BFS)
after与迷宫-NC14608(两次bfs)after的算法书的遗落在一个叫做AIJ的迷宫中了,这个迷宫有N*M个房间,迷宫的入口为(1,1),算法书遗落在(r,c)。迷宫中的房间有四种状态:空房间、无法进入的房间、有墨菲斯托存在的房间和有莉莉丝存在的房间。墨菲斯托会否定一切,而莉莉丝会诱惑人做一种叫做YK的活动。after是一个意志薄弱的人,他遇到了墨菲斯托和莉莉丝之后,便会变成眼神空洞的超级YK机器人。after每步可以从他当前的房间走至上下左右四个房间的其中一个房间。after害怕变成超级YK机器
2020-10-09 22:24:28 290
原创 POJ - 2531 Network Saboteur 最大割 DFS
自己一开始没咋看明白,很多知识点都不知道。转载两份代码。第一份:出处:http://exp-blog.com大佬思想:题目大意:把一个完全图分成两部分,使得连接这两部分边的权和最大。解题思路:图论的无向完全图的最大割问题 (做网络最大流的时候同学们应该看过最小割,所以别问我什么是最大割了。。。不懂的百度去。。。)可以用 随机化算法 Random Algorithm 去做一开始我没读懂题,以为是求最大权。。。傻呼呼的用最了最小生成树的算法去做= =一直RERERE。。。还以为是数组开得不
2020-10-08 23:35:18 212
原创 ZOJ - 3785 打表找规律
It’s Saturday today, what day is it after 11 + 22 + 33 + … + NN days?InputThere are multiple test cases. The first line of input contains an integer T indicating the number of test cases. For each test case:There is only one line containing one integer
2020-10-08 23:23:00 192
原创 ZOJ - 3782 水题,不要看作中缀式
Complete the ternary calculation.InputThere are multiple test cases. The first line of input contains an integer T indicating the number of test cases. For each test case:There is a string in the form of “number1 operatora number2 operatorb number3”. Ea
2020-10-08 23:20:44 108
原创 ZOJ 3778 找规律
As we all know, Coach Gao is a talented chef, because he is able to cook M dishes in the same time. Tonight he is going to have a hearty dinner with his girlfriend at his home. Of course, Coach Gao is going to cook all dishes himself, in order to show off
2020-10-08 22:57:45 165
原创 ZOJ 3714 水题,遍历一遍
There are N little kids sitting in a circle, each of them are carrying some java beans in their hand. Their teacher want to select M kids who seated in M consecutive seats and collect java beans from them.The teacher knows the number of java beans each ki
2020-10-08 22:52:06 119
原创 ZOJ 3706 模拟 水题 STL
题目:Break Standard WeightTime Limit: 2000 msMemory Limit: 65536 KBThe balance was the first mass measuring instrument invented. In its traditional form, it consists of a pivoted horizontal lever of equal length arms, called the beam, with a weighing pan,
2020-10-08 22:15:10 145
原创 HDU1175(dfs+剪枝)
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1175dfs:定义函数时注意设计参数本题:dfs(x,y,dic,turns)x,y为当前搜索起点dic为当前前进方向turns为当前转弯数注意初始化及边界情况注意搜索终止条件思路:dfs搜索剪枝:第二次转弯后,判断与目标是否在同一直线上#include"iostream"#include"cstdio"#include"stdlib.h"#include"cmath"#inclu
2020-10-05 21:30:16 145
原创 Gym - 102220B Balanced Diet
题目链接:https://codeforces.com/gym/102220/problem/B说题解之前,因为TL很多次,说说cin的加速和scanf。std::ios::sync_with_stdio(0);来加速cin 与cout ,这样cin的速度就和sanf差不多了,注意,这两个代码的头文件是 iostream并且如果用了这两个,就不要用scanf ,getchar,gets,fgets,fscanf了,他的作用是关于 iostream和stdio的同步,让c++和c的输入出不在挂钩
2020-10-04 23:43:03 270
原创 Gym - 102220C Line-line Intersection(线段相交)
题目链接:https://vjudge.net/problem/Gym-102220C/origin题解:两条直线不平行必相交,若平行:若重合答案加1,否则不算。#include<bits/stdc++.h>using namespace std;struct node{ long long x,y,x1,y1,x2,y2,b;} s[100005];int cmp(node n1,node n2){ if(n1.x*n2.y==n2.x*n1.y)//k { retu
2020-10-04 23:37:56 371
原创 Gym-102220J Time Limit(水题)
题目链接:https://codeforces.com/gym/102220/problem/J#include"iostream"#include"cstdio"#include"stdlib.h"#include"cmath"#include"cstring"#include"cstdlib"#include"vector"#include"stack"#include"queue"#include"set"#include"map"#include"algorithm"#in
2020-10-04 23:28:18 263
原创 面向对象程序设计(java)mooc--课堂代码
AMoneyCoin.javapackage Coins;import java.util.HashMap;import java.util.Scanner;public class Coin { private HashMap<Integer, String> coinnames = new HashMap<Integer, String>(); public Coin() { coinnames.put(1, "penny"); coinnames.
2020-10-01 20:48:12 312
转载 POJ 3279 搜索
Time limit 2000 msMemory limit 65536 kBDescriptionFarmer John knows that an intellectually satisfied cow is a happy cow who will give more milk. He has arranged a brainy activity for cows in which they manipulate an M × N grid (1 ≤ M ≤ 15; 1 ≤ N ≤ 15) o
2020-09-26 11:29:31 154
原创 基于邻接表的图的遍历
(1)建立一个邻接表存储的图;(2)输出图的邻接表;(3)输出各顶点的度(若是有向图,输出各顶点的入度、出度和度);(4)对图进行深度优先、广度优先遍历。【测试数据】(1)输入图的种类:2输入图的顶点数和边数:5 5输入各条边:0 1 0 3 1 2 2 3 2 4(2)输入图的种类:0输入图的顶点数和边数:3 4输入各条边:0 1 0 2 1 0 1 2#include <iostream>#include <malloc.h>#include &
2020-09-22 16:52:11 584
原创 稀疏矩阵的应用
已知两个稀疏矩阵A和B采用三元组顺序表存储,求:M= A+B、M= A-B和M= A×B。【测试数据】A的三元组表为:(0, 2, -9)(0, 4, 5)(1, 0, -7)(1, 2, 7)(3, 1, 8)(4, 2, 9)B的三元组表为:(1, 0, 7)(1, 2, 7)(2, 1, 1)(3, 0, 1)(4, 4, 1)和:差:积:#include <iostream>#define M 5#define N 5#define MAXSIZE 25
2020-09-22 16:50:03 852
原创 排序综合程序设计(快速,希尔,插入,选择,冒泡)
#include"iostream"#include"cstdio"#include"stdlib.h"#include"cstring"#include"cstdlib"#include"vector"#include"map"#include"algorithm"#include <iomanip>#include <time.h>#include <fstream>#include <sstream>using namespace
2020-09-20 21:10:11 277
原创 POJ1321 简单搜索
题目:在一个给定形状的棋盘(形状可能是不规则的)上面摆放棋子,棋子没有区别。要求摆放时任意的两个棋子不能放在棋盘中的同一行或者同一列,请编程求解对于给定形状和大小的棋盘,摆放k个棋子的所有可行的摆放方案C。Input输入含有多组测试数据。每组数据的第一行是两个正整数,n k,用一个空格隔开,表示了将在一个n*n的矩阵内描述棋盘,以及摆放棋子的数目。 n <= 8 , k <= n当为-1 -1时表示输入结束。随后的n行描述了棋盘的形状:每行有n个字符,其中 # 表示棋盘区域, . 表
2020-09-19 20:25:03 97
原创 HDU-1010 奇偶性剪枝+dfs
Problem DescriptionThe doggie found a bone in an ancient maze, which fascinated him a lot. However, when he picked it up, the maze began to shake, and the doggie could feel the ground sinking. He realized that the bone was a trap, and he tried desperately
2020-09-17 20:19:22 138
原创 数学考试--思维题,前缀和
链接:https://ac.nowcoder.com/acm/problem/15553来源:牛客网今天qwb要参加一个数学考试,这套试卷一共有n道题,每道题qwb能获得的分数为ai,qwb并不打算把这些题全做完,他想选总共2k道题来做,并且期望他能获得的分数尽可能的大,他准备选2个不连续的长度为k的区间,即[L,L+1,L+2,…,L+k-1],[R,R+1,R+2,…,R+k-1](R >= L+k)。输入描述:第一行一个整数T(T<=10),代表有T组数据接下来一行两个整数n
2020-09-08 20:58:13 181
原创 排序
快速排序1.分而治之(递归)选择主元 ,以及分。细节重要表排序我们对Markdown编辑器进行了一些功能拓展与语法支持,除了标准的Markdown编辑器功能,我们增加了如下几点新功能,帮助你用它写博客:全新的界面设计 ,将会带来全新的写作体验;在创作中心设置你喜爱的代码高亮样式,Markdown 将代码片显示选择的高亮样式 进行展示;增加了 图片拖拽 功能,你可以将本地的图片直接拖拽到编辑区域直接展示;全新的 KaTeX数学公式 语法;增加了支持甘特图的mermaid语法1 功能;.
2020-08-18 22:50:23 122
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人