题目链接 ZOJ Monthly, March 2018 Problem G 题意 给定一个字符串.现在求一个下标范围$[0, n - 1]$的$01$序列$f$.$f[x] = 1$表示存在一种方案,删掉原字符串中的连续$x$个字母, 使得剩下的字符串中任意相邻的两个字母都不同.在这道题中所有的字符串首尾字符看做是相邻的. 对于每个起始位置求出最多往右延伸到的位置,满足该区间代表的字符串是一个满足任意相邻字母不同的字符串. 首先考虑一个连续的满足任意相邻字母不同的字符串.设其长度为$l$…
[题目链接] A. ZOJ 4004 - Easy Number Game 首先肯定是选择值最小的 $2*m$ 进行操作,这些数在操作的时候每次取一个最大的和最小的相乘是最优的. #include <bits/stdc++.h> using namespace std; const int maxn = 100010; int T, n, m; long long a[maxn]; int main() { scanf("%d", &T); while(T--) {…
A - Easy Number Game 水. #include <bits/stdc++.h> using namespace std; #define ll long long #define N 100010 ll arr[N]; int n, m; int main() { int t; scanf("%d", &t); while (t--) { scanf("%d%d", &n, &m); ; i <= n; +…
A. Easy Number Game 贪心将第$i$小的和第$2m-i+1$小的配对即可. #include<cstdio> #include<algorithm> using namespace std; const int N=100010; int n,m,i,Case,a[N];long long ans; int main(){ scanf("%d",&Case); while(Case--){ scanf("%d%d",…
微软已按先前预期于美国时间 2018 年 4 月 30 日正式向所有用户发布了 Windows 10 Version 1803 (Updated March 2018) 的 ISO 镜像下载,按微软官方说法,建议用户最好选择全新安装方式进行更新,欢迎大家下载. 此次消费者(consumer)镜像微软采用了6in1镜像发布,内含家庭版.家庭单语言版.教育版.专业版.专业教育版.专业工作站版. 文件名:cn_windows_10_consumer_editions_version_1803_upda…
2018 ACM-ICPC 中国大学生程序设计竞赛线上赛:https://www.jisuanke.com/contest/1227 题目链接:https://nanti.jisuanke.com/t/26219 Rock Paper Scissors Lizard Spock Description: Didi is a curious baby. One day, she finds a curious game, which named Rock Paper Scissors Lizard…
A - Candy Game 水. #include <bits/stdc++.h> using namespace std; #define N 1010 int t, n; int a[N], b[N]; int main() { scanf("%d", &t); while (t--) { scanf("%d", &n); ; i <= n; ++i) scanf("%d", a + i); ; i <…
Prime Query Time Limit: 1 Second Memory Limit: 196608 KB You are given a simple task. Given a sequence A[i] with N numbers. You have to perform Q operations on the given sequence. Here are the operations: A v l, add the value v to element with i…
Number Game Time Limit: 2 Seconds Memory Limit: 65536 KB The bored Bob is playing a number game. In the beginning, there are n numbers. For each turn, Bob will take out two numbers from the remaining numbers, and get the product of them. There i…
题目链接:http://acm.zju.edu.cn/onlinejudge/showContestProblem.do?problemId=5840 Time Limit: 1 Second Memory Limit: 65536 KB If we define $f(0)=1,f(1)=0,f(4)=1,f(8)=2,f(16)=1 \cdots$, do you know what function $f$ means? Actually, $f(x)$ calculates the to…
Help Bob Time Limit: 2 Seconds Memory Limit: 65536 KB There is a game very popular in ZJU at present, Bob didn't meant to participate in it. But he decided to join it after discovering a lot of pretty girls playing it. There are n stones on the…