朴素做法暴力DP,O(nk)过不去。。。 1 #include <cmath> 2 #include <cstdio> 3 #include <cstring> 4 #include <algorithm> 5 #define N1 2005 6 #define ll long long 7 usi ...
分类:
其他好文 时间:
2020-10-18 16:56:48
阅读次数:
23
题目链接:https://codeforces.com/problemset/problem/868/C 如果有方案,那么肯定可以用两道题目完成 这是证明 #include<cstdio> #include<cstring> #include<algorithm> #include<iostream ...
分类:
其他好文 时间:
2020-10-18 10:20:12
阅读次数:
30
Given an input string s, reverse the order of the words. A word is defined as a sequence of non-space characters. The words in s will be separated by ...
分类:
其他好文 时间:
2020-10-18 10:19:49
阅读次数:
29
性质题好评。 对于这类题目,我们肯定要先计算出题目中给出的 \(f(x)=\max\limits_{i=1}^ndist(x,i)\)。这个东西可以通过换根 \(\text{DP}\) 在 \(O(n)\) 的时间内计算出来。 选出 \(f_x\) 最小的,以它为根,记作 \(u\)。这棵树的父亲的 ...
分类:
其他好文 时间:
2020-10-18 10:11:23
阅读次数:
19
1 #pragma once 2 #include <initializer_list> 3 struct String { 4 String(const char*s) { 5 c_str = new char[strlen(s)+1]; 6 while (*s) { 7 *(c_str+sz) ...
分类:
其他好文 时间:
2020-10-18 10:09:18
阅读次数:
18
7-108 将x的平方赋值给y (5分) 假设x的值为3,计算x的平方并赋值给y,分别以“y = x ? x”和“x ? x = y”的形式输出x和y的值。 输入格式: 本题无输入 输出格式: 按照下列格式输出代入x=3的结果: y = x * x x * x = y#include<stdio.h ...
分类:
其他好文 时间:
2020-10-18 10:06:58
阅读次数:
36
所谓年轻,就是意识不到自己的年轻 #include<iostream> #include<cstdio> #include<cstring> #include<algorithm> using namespace std; unsigned long long n,m; unsigned long ...
分类:
其他好文 时间:
2020-10-18 10:06:40
阅读次数:
20
#include<bits/stdc++.h>包含了目前c++所包含的所有头文件 对比: #include <iostream> #include <cstdio> #include <fstream> #include <algorithm> #include <cmath> #include < ...
分类:
编程语言 时间:
2020-10-18 09:59:50
阅读次数:
17
7-76 计算分段函数[3] (10分) 本题目要求计算下列分段函数f(x)的值: 输入格式: 输入在一行中给出实数x。 输出格式: 在一行中按“f(x) = result”的格式输出,其中x与result都保留一位小数。 输入样例1: 10 输出样例1: f(10.0) = 0.1 输入样例2: ...
分类:
其他好文 时间:
2020-10-18 09:59:34
阅读次数:
24
一、类模板说明 std::function是一个函数包装器模板,最早来自boost库,对应其boost::function函数包装器。在c++0x11中,将boost::function纳入标准库中。该函数包装器模板能包装任何类型的可调用元素(callable element),例如普通函数和函数对 ...
分类:
其他好文 时间:
2020-10-18 09:56:03
阅读次数:
18