自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(14)
  • 收藏
  • 关注

原创 简单背包问题(简单动态规划)

简单背包问题有 N 件物品和一个容量是 V 的背包。每件物品只能使用一次。第 i 件物品的体积是 vi,价值是 wi。求解将哪些物品装入背包,可使这些物品的总体积不超过背包容量,且总价值最大。输出最大价值。输入格式:第一行两个整数,N,V ,用空格隔开,分别表示物品数量和背包容积。接下来有 N 行,每行两个整数 vi,wi,用空格隔开,分别表示第 i 件物品的体积和价值。输出格式:输出一个整数,表示最大价值。数据范围0<N,V≤1000 ,0<vi,wi≤1000输入样例:4 5

2021-05-24 15:54:16 601

原创 2021-05-22 补题

B - StepsOne day Vasya went out for a walk in the yard but there weren’t any of his friends outside and he had no one to play touch and run. But the boy didn’t lose the high spirits and decided to play touch and run with himself. You may ask: “How did he

2021-05-22 16:52:40 223

原创 2021-5-15补题

Codeforces Beta Round #107(Div2)B - Phone NumbersWinters are just damn freezing cold in Nvodsk! That’s why a group of n friends prefers to take a taxi, order a pizza and call girls. The phone numbers in the city consist of three pairs of digits (for exam

2021-05-22 16:26:13 590

原创 2021-04-25

2021-4-28 华山论剑团体天梯赛赛后总结昨天参加了今年(2021)天梯赛,所以经过一天的沉淀我来回想一下昨天的收获与不足。在此,我将本次比赛大致分为赛前准备,赛事监考以及赛场发挥。首先,来说一说赛前准备,对于一周前的模拟赛吃进了苦头,这次好了不少但是也有几分狼狈。对于比赛所需要的装备,计算机(使用自己的机器并且需要带前置摄像头),外置摄像头(如果计算机没有摄像头),鼠标键盘(自带,可不带,按照自己的习惯来),手机一台(登录微信,运行小程序据说小米,荣耀有不能运行的先例),手机支架(对于双机

2021-04-25 21:46:12 115

原创 2020.06.09——习题训练五题解

A - Sum of Odd IntegersYou are given two integers nn and kk. Your task is to find if nn can be represented as a sum of kk distinct positive odd (not divisible by 22) integers or not.You have to answer tt independent test cases.InputThe first line of the

2020-06-12 21:55:45 4246

原创 第四次练习6.1

A - Dreamoon and Ranking CollectionDreamoon is a big fan of the Codeforces contests.One day, he claimed that he will collect all the places from 11to 5454after two more rated contests. It’s amazing!Based on this, you come up with the following problem:T

2020-06-04 15:43:49 929

原创 第三次习题2020.5.26

A - Sorted Adjacent DifferencesYou have array of nnnumbers a1,a2,…,ana1,a2,…,an. Rearrange these numbers to satisfy |a1−a2|≤|a2−a3|≤…≤|an−1−an||a1−a2|≤|a2−a3|≤…≤|an−1−an|, where |x||x|denotes absolute value of xx. It’s always possible to find such re

2020-05-30 21:28:17 2044

原创 第二次习题2020.5.22

A - CandiesRecently Vova found nn candy wrappers. He remembers that he bought xx candies during the first day, 2x2x candies during the second day, 4x4x candies during the third day, ……, 2k−1x2k−1x candies during the kk-th day. But there is an issue: Vova

2020-05-26 00:09:39 1752

原创 F - Nastya and Door

F - Nastya and Door题意n座山当高度大于左右两座称为峰,一个足够长的门倒下被山峰隔断,问k个长度最多隔断几段。思路先进行一次遍历,统计峰,两端不能为峰,再次遍历利用数组差得出段数选最大的。代码#include<iostream>#include<cmath>using namespace std;int main(){ int t; cin>>t; while(t--){ int n,k,i

2020-05-20 22:12:02 249

原创 E - Nastya and Rice

E - Nastya and Rice题意:对于n粒米每粒重量范围a-b,a+b,总重量c-d,c+d。判断是否正确。思路根据题意即可。代码#include#includeusing namespace std;int main(){    int t;    cin>>t;    while(t–){      &n

2020-05-20 20:59:02 147

原创 D - Binary Period

D - Binary Period题意给出一个字符串,只包含1,0输入的t是s的子字符串根据t推导s。(s<=2*t)思路如果子字符串只有一种字符,直接输出;存在两种我们可以假设每个字符来自s的一个‘10’。代码#include#include#includeusing namespace std;int main(){    int t,i;    char s[102];   

2020-05-20 20:06:27 219

原创 C - Road To Zero

C - Road To ZeroNoteIn the first test case you can perform the following sequence of operations: first, second, first. This way you spend 391+555+391=1337391+555+391=1337 dollars.In the second test case both integers are equal to zero initially, so you

2020-05-20 18:32:44 141

原创 B - Phoenix and Beauty

B - Phoenix and BeautyPhoenix loves beautiful arrays. An array is beautiful if all its subarrays of length kk have the same sum. A subarray of an array is any sequence of consecutive elements.Phoenix currently has an array aa of length nn. He wants to in

2020-05-20 17:51:45 153

原创 Phoenix and Balance

Phoenix and BalancePhoenix has nn coins with weights 21,22,…,2n21,22,…,2n. He knows that nn is even.He wants to split the coins into two piles such that each pile has exactly n2n2 coins and the difference of weights between the two piles is minimized. Fo

2020-05-18 23:20:08 241

空空如也

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除