Problem Description Now you are back,and have a task to do: Given you a string s consist of lower-case English letters only,denote f(s) as the number of distinct sub-string of s. And you have some query,each time you should calculate f(s[l...r]), s[l
DQUERY - D-query #sorting #tree English Vietnamese Given a sequence of n numbers a1, a2, ..., an and a number of d-queries. A d-query is a pair (i, j) (1 ≤ i ≤ j ≤ n). For each d-query (i, j), you have to return the number of distinct elements in the
题目大概:求区间内x出现的次数 出题人yjy Description ZJK 给你一个长度为 n 的数列和 m 次询问,每次询问从第 l 个到第 r 个数中,数 x 出现了多少次.Input第一行一个整数 n,第二行 n 个整数,表示这个数列.第三行一个整数 m,表示询问数.下面 m 行,每行三个整数 l, r, x,表示询问[l, r]之间数 x 出现的次数Output对于每个询问操作,输出该询问的答案.答案之间用换行隔开,一共 m 行.Example61 1 2 3 3 181 6 13 5
晚饭后朋友发来个问题,正好无事做,动手写了一下 若一个正整数有偶数个不同的真因子,则称该数为幸运数.如4含有2个真因子为 1 和 2 .故4是幸运数.求[2,100]之间的全部幸运数之和. 常规思路 被除数一直除以 1 2 3 ... 直到除以它自身,不过这种比较消耗资源(周知python简洁但效率不高) getf.py def get_Factor(x): """ n 需要求真因数的数(被除数) x x 除数 y rem 余数 quo 商 """
#include<iostream> #include<stdio.h> #include<string.h> #include<algorithm> #include<math.h> using namespace std; ; int a[maxx]; int vis[maxx]; int ans[maxx]; int block; int res; struct node { int l,r; int id; friend bool ope
#6278. 数列分块入门 2 内存限制:256 MiB时间限制:500 ms标准输入输出 题目类型:传统评测方式:文本比较 上传者: hzwer 提交提交记录统计测试数据讨论 6 题目描述 给出一个长为 nn 的数列,以及 nn 个操作,操作涉及区间加法,询问区间内小于某个值 xx 的元素个数. 输入格式 第一行输入一个数字 nn. 第二行输入 nn 个数字,第 ii 个数字为 a_iai,以空格隔开. 接下来输入 nn 行询问,每行输入四个数字 \mathrm{opt}opt.ll.r
No Pain No Game Time Limit: 4000/2000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others) Total Submission(s): 2000 Accepted Submission(s): 851 Problem Description Life is a game,and you lose it,so you suicide. But you can not kill yours
Group Time Limit: 4000/2000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 1959 Accepted Submission(s): 1006 Problem Description There are n men ,every man has an ID(1..n).their ID is unique. Whose ID is i and i
#include<bits/stdc++.h>using namespace std;const long long mod = 998244353;typedef const long long ll;vector<long long>p;long long inv(long long x,long long y)//快速幂求逆元模板(以乘代除){ long long r=1; while(y>0) { if(y&1)