Problem C C . 小 花梨 判连通 时间限制:2000ms 空间限制:512MB Description 小花梨给出…
https://acm.ecnu.edu.cn/contest/173/problem/E/ 分析: 考虑这样一种情况,如果对一个点连续地做几次乘操作,那么之后紧跟着的除操作只需要将乘操作的次数减少即可.(因为如果当前是乘于的最小素因子后面肯定也是除上这个) 那么对这个点的操作将会变成连续的一段乘或者除.如果一段除操作之后出现了乘操作,那只能在一段除之后做一段乘操作了,因为执行了除之后minprime可能会变化.(很显然) 所以最后对这个点的操作将会变成一段除操作跟着一段乘操作. 那么就可以利用…
"美登杯"上海市高校大学生程序设计邀请赛 (华东理工大学) D. 小花梨的取石子游戏 Description 小花梨有…
Problem E E . 小 花梨 的数组 时间限制:1000ms 空间限制:512MB Description 小花梨得到了一个长度为…
题目链接:https://acm.ecnu.edu.cn/contest/173/problem/B/#report9 Problem B B . 小 花梨 的 三角形 时间限制:1000ms 空间限制:512MB Description 小花梨现在有一个…
题意 分析 预处理出每个数的最小素因子,首先可以知道\(minprime(x*minprime(x))=minprime(x)\),我们用线段树维护区间最大值\(mx[p]\),注意这里的最大值并不是实际的最大值,同时维护区间\(a[i]\)乘\(minprime(a[i])\)的次数的最小值\(mnt[p]\) 对于操作1,直接区间更新\(mnt[p]\)加1. 对于操作2,有两种情况: 当\(mnt[p]=0\)时,表示当前区间内至少有一个数乘最小素因子的次数为0,一个数除以它的最小素因子后…
A - 口算训练 题意:询问 $[L, R]$区间内 的所有数的乘积是否是D的倍数 思路:考虑分解质因数 显然,一个数$x > \sqrt{x} 的质因子只有一个$ 那么我们考虑将小于$\sqrt {x}$ 的质因子用线段树维护 其他质因子用vector 维护存在性 #include <bits/stdc++.h> using namespace std; #define N 100010 #define block 317 vector <]; int t, n, q; int…
口算训练 #include <iostream> #include <algorithm> #include <cstring> #include <cstdio> #include <string> #include <map> #include <cmath> #include <vector> #define Faster ios::sync_with_stdio(false),cin.tie(0) #d…
POJ1182 http://poj.org/problem?id=1182 题目 难得的中文题... 食物链 Time Limit: 1000MS Memory Limit: 10000K Total Submissions: 56252 Accepted: 16485 Description 动物王国中有三类动物A,B,C,这三类动物的食物链构成了有趣的环形.A吃B, B吃C,C吃A. 现有N个动物,以1-N编号.每个动物都是A,B,C中的一种,但是我们并不知道它到底是哪一种. 有人用两种说…
题目描述 It's universally acknowledged that there're innumerable trees in the campus of HUST. Thus a professional tree manager is needed. Your task is to write a program to help manage the trees. Initially, there are n forests and for the i-th forest the…