C. Tourist Problem time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output Iahub is a big fan of tourists. He wants to become a tourist himself, so he planned a trip. There are n destinations on a…
C. Tourist Problem time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output Iahub is a big fan of tourists. He wants to become a tourist himself, so he planned a trip. There are n destinations on a…
题目链接:Codeforces Round #367 (Div. 2) C. Hard problem 题意: 给你一些字符串,字符串可以倒置,如果要倒置,就会消耗vi的能量,问你花最少的能量将这些字符串排成字典序 题解: 当时1点过头太晕了,看错题了,然后感觉全世界都会,就我不会,- -!结果就是一个简单的DP, 设dp[i][0]表示第i个字符串不反转的情况,dp[i][1]表示第i个字符串反转的情况 状态转移方程看代码 #include<bits/stdc++.h> #define F(…
Codeforces Round #198 (Div. 2) 昨天看到奋斗群的群赛,好奇的去做了一下, 大概花了3个小时Ak,我大概可以退役了吧 那下面来稍微总结一下 A. The Wall Iahub and his friend Floyd have started painting a wall. Iahub is painting the wall red and Floyd is painting it pink. You can consider the wall being mad…
Codeforces Round #603 (Div. 2) A. Sweet Problem A. Sweet Problem time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output You have three piles of candies: red, green and blue candies: the first pile…
Hard problem 题目链接: http://codeforces.com/contest/706/problem/C Description Vasiliy is fond of solving different tasks. Today he found one he wasn't able to solve himself, so he asks you to help. Vasiliy is given n strings consisting of lowercase Engl…
A.The Wall 题意:两个人粉刷墙壁,甲从粉刷标号为x,2x,3x...的小块乙粉刷标号为y,2y,3y...的小块问在某个区间内被重复粉刷的小块的个数. 分析:求出x和y的最小公倍数,然后做一个一维的区间减法就可以了. #include <cstdlib> #include <cstdio> #include <cstring> #include <algorithm> using namespace std; typedef long long L…
C. Tourist Problem time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output Iahub is a big fan of tourists. He wants to become a tourist himself, so he planned a trip. There are n destinations on a…
接着是C,D的题解 C. Tourist Problem Iahub is a big fan of tourists. He wants to become a tourist himself, so he planned a trip. There are n destinations on a straight road that Iahub wants to visit. Iahub starts the excursion from kilometer 0. The n destina…
A. The Wall 求下gcd即可. B. Maximal Area Quadrilateral 枚举对角线,根据叉积判断顺.逆时针方向构成的最大面积. 由于点坐标绝对值不超过1000,用int比较快. C. Tourist Problem 假设序列为\(p_1,p_2,...,p_n\),则距离总和为\(,,,p_1,|p_2-p_1|,...,|p_n-p_{n-1}|\). 第1个点\(p_1\)的贡献为\(\sum a_i(n-1)!\) \(|p_i-p_{i-1}|\)的贡献为\…