当前位置: 首页 > news >正文

网站虚拟主机建设一个工厂的网站建设

网站虚拟主机建设,一个工厂的网站建设,详情页制作,在线制作图片免费的软件文章目录 A题目AC Code#xff1a; B题目AC Code#xff1a; C题目AC Code#xff1a; D题目AC Code#xff1a; E题目AC Code#xff1a; F题目AC Code#xff1a; A 题目 此题尽量让后面的更大#xff0c;前面的更小。 我们尽量让第 3 3 3 位更大#xff0c;如果… 文章目录 A题目AC Code B题目AC Code C题目AC Code D题目AC Code E题目AC Code F题目AC Code A 题目 此题尽量让后面的更大前面的更小。 我们尽量让第 3 3 3 位更大如果 3 3 3 位取到 z还有 2 2 2 及以上时就往第 2 2 2 位取第二位取满后就取第 1 1 1 位。分情况讨论很容易写出代码。 AC Code #include algorithm #include iostream #include cstring #include vector #include queue #include stack #include cmath #include list #include set #include map using namespace std; int q, t;int main(){ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);cin q;while (q --) {cin t;if (t 28) {cout aa char(t - 2 a - 1);cout \n;}else if (t 53){cout a;t - 27;cout char(t a - 1) z;cout \n;}else {t - 52;cout char(t a - 1) zz;cout \n;}}return 0; }B 题目 我们用一个变量记录能给后面倒的水的单位数。我们从左往右遍历 如果当前遍历到的水量大于平均水量就把多的添加到变量里。如果当前便利的水量小于平均水量且变量里面单位数能够把当前遍历到的水量添加到平均值就添加变量值减小当前水量差平均值的部分。否则就表明无解退出。 如果遍历完都没有退出就表明有解输出答案走人。 AC Code #include algorithm #include iostream #include cstring #include vector #include queue #include stack #include cmath #include list #include set #include map using namespace std; int t; int n, a[200100]; long long sum; void Main() {cin n;sum 0;for (int i 1; i n; i ) {cin a[i];sum a[i];}sum / n;long long sum1 0;for (int i 1; i n; i ) {if (a[i] sum) {sum1 a[i] - sum;}else {if (sum1 (sum - a[i])) {sum1 - (sum - a[i]);}else {cout NO \n;return ;}}}cout YES \n; } int main(){ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);cin t;while (t --) {Main();}return 0; }C 题目 我们选择每一种填充颜色因为要覆盖整个序列所以只有前缀和后缀才关系到我们的代价对于当前数一直找知道找到数组前缀和后缀里的所有元素都和当前数相等剩下的就是我们要覆盖的。对于每一个找过的元素记录下来不再讨论。 AC Code #include algorithm #include iostream #include cstring #include vector #include queue #include stack #include cmath #include list #include set #include map using namespace std; int q, n, a[200100]; bool vis[200100];int main(){ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);cin q;while (q --) {cin n;vectorint v; mapint, int m;for (int i 1; i n; i ) cin a[i];for (int i 1; i n; i ) {v.push_back(a[i]);}v.erase(unique(v.begin(), v.end()), v.end());sort(v.begin(), v.end());for (int i 0; i (int)v.size(); i ) {m[v[i]] i;}for (int i 1; i n; i ) {a[i] m[a[i]];}int ans 0x3f3f3f3f;memset(vis, 0, sizeof(vis));for (int i 1; i n; i ) {if (!vis[a[i]]) {vis[a[i]] 1;int l 1, r n;while (a[l] a[i] l n) l;while (a[r] a[i] r l) r--;ans min(ans, r - l 1);}}cout ans \n;}return 0; }D 题目 我们发现对于每两个数 a a a 和 b b b如果这两个数符合题目要求就表明 a a a 除以 y y y 的余数等于 b b b 除以 y y y 的余数 a a a 除以 x x x 的余数加上 b b b 除以 x x x 的余数要么为 0 0 0要么为 x x x。 有了这个结论就可以开始编码。我们可以将数按除以 y y y 的余数排序这样保证除以 y y y 的余数相等的数都挨在一起。再找到每一个连续的除以 y y y 相等的区间对于每一个除以 x x x 的余数为 p p p 的数让答案加上数列里除以 x x x 余数为 x − p x - p x−p 的数的个数如果 p x − p px-p px−p说明加上了自己要减去 1 1 1此外如果 p 0 p0 p0我们就要找除以 x x x 余数为 0 0 0 的个数同样要减去一。 注意要开长整型注意边界问题。 AC Code #include algorithm #include iostream #include cstring #include vector #include queue #include stack #include cmath #include list #include set #include map using namespace std; int t, n, x, y; struct node{int a, mod_x, mod_y; }; node a[200100]; bool cmp(node a, node b) {return a.mod_y b.mod_y; } long long ans; mapint, int cnt; int main(){ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);cin t;while (t --) {ans 0;cin n x y;for (int i 1; i n; i ) cin a[i].a;for (int i 1; i n; i ) {a[i].mod_x a[i].a % x;a[i].mod_y a[i].a % y;}sort(a 1, a n 1, cmp);int i 1;while (i n) {int l i, r i;while (a[l].mod_y a[r].mod_y r n) r;r--;if (l r) {i r 1;continue;}for (int j l; j r; j) {cnt[a[j].mod_x];}for (int j l; j r; j) {if (a[j].mod_x 0) {ans cnt[0];ans--;}else {ans cnt[x - a[j].mod_x];if (a[j].mod_x * 2 x) ans--;}}i r 1;cnt.clear();}ans / 2;cout ans \n;}return 0; }E 题目 我们发现对于每一个末尾有 p p p 个 0 0 0 的数翻转会让这个数少 p p p 位对于安娜翻转一个数会让最终的数长度减少这个数后缀 0 0 0 的个数而对于萨沙合并一个数会让这个数后缀 0 0 0 无法消除。 所以安娜尽量选择后缀 0 0 0 更多的翻转萨沙尽量选择后缀 0 0 0 更多的数消除。统计每个数后缀 0 0 0 的个数然后从大到小排序因为安娜是先手所以她会翻转第 1 1 1 大第 3 3 3 大第 5 5 5 大最后统计答案位数判断输出完结撒花。 AC Code #include algorithm #include iostream #include cstring #include vector #include queue #include stack #include cmath #include list #include set #include map using namespace std; int t; int n, m; struct node{string a; int cnt; }; node a[200100]; bool cmp(node a, node b) {return a.cnt b.cnt; }int main(){ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);cin t;while (t --) {cin n m;int sum 0;for (int i 1; i n; i ) cin a[i].a;for (int i 1; i n; i ) {for (int j a[i].a.size() - 1; j 0; j --) {if (a[i].a[j] ! 0) {a[i].cnt a[i].a.size() - j - 1;break;}}sum a[i].a.size();}sort(a 1, a n 1, cmp);for (int i 1; i n; i 2) {sum - a[i].cnt;} // for (int i 1; i n; i ) { // cout a[i].cnt ; // } // cout \n;if (sum m) {cout Sasha;}else {cout Anna;}cout \n;}return 0; }F 题目 我们发现对于每一张截图除开第一个数字如果 a a a 比 b b b 靠前说明序列中 a a a 比 b b b 靠前。如有一张截图中 a a a 比 b b b 靠前另一张截图中 b b b 比 a a a 靠前均除开第一个数字说明无解。暴力枚举 a a a 和 b b b 是不行的。我们发现这个关系可以看做一张图中的边而每一个数字就是一个点。如果这张图中有环说明无解。 对于每一张截图除开第一个数字对于每一个剩下的数字我们往后面的一个数字建一条有向边不需要建多条因为其他的关系可以通过这些边推导出来。然后在这张图上判断一遍是否有环即可。可以用 DFS 或拓补排序判断。我推荐拓补稳定的 O ( n ) O(n) O(n)。 AC Code #include algorithm #include iostream #include cstring #include vector #include queue #include stack #include cmath #include list #include set #include map using namespace std; struct edge{int u, v, nxt; }; edge ed[400100]; int edcnt, head[200100]; void addedge(int u, int v){edcnt;ed[edcnt].u u;ed[edcnt].v v;ed[edcnt].nxt head[u];head[u] edcnt; } int t; int n, k; int a[200100]; int deg[200100]; queueint q;int main(){ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);cin t;while (t --) {edcnt 0;memset(head, 0, sizeof(head));memset(deg, 0, sizeof(deg));cin n k;for (int i 1; i k; i ) {for (int j 1; j n; j ) {cin a[j];}for (int j 2; j n; j ) {addedge(a[j], a[j 1]);deg[a[j 1]];}}for (int i 1; i n; i ) {if (!deg[i]) {q.push(i);}}int cnt 0;while (q.size()) {int now q.front();q.pop();cnt;for (int i head[now]; i; i ed[i].nxt) {int v ed[i].v;deg[v]--;if (!deg[v]) {q.push(v);}}}if (cnt n) {cout YES\n;}else {cout NO\n;}}return 0; }
http://www.pierceye.com/news/180631/

相关文章:

  • 网站方案策划中国最大的博客网站
  • 网站建设加空间食品包装设计ppt
  • 搭建一个网站 优帮云张家口远大建设集团网站
  • wordpress本地视频播放器苏州谷歌seo
  • 银川网站建设有哪些16岁做分期网站
  • 制作网站对话框火车票网站建设多少
  • 怎么问客户做不做网站设计一个简单的广告
  • 佛山 网站关键词优化trel域名
  • 哪家网站建设好大连房产网
  • 企业做推广哪些网站比较好兰州有做百度网站的吗
  • 网站建设和管理规则自己建网站的流程
  • 网站的前期推广广州网站建设加盟
  • 网站灰色 代码深圳的深圳的网站建设公司
  • 做电影采集网站需要多大vps安徽建设新工程信息网站
  • 中小企业网站制作化工厂网站建设
  • 电子政务网站建设出版社百度网页提交入口
  • 专业柳州网站建设哪家便宜淄博桓台网站建设定制
  • 网站建设投标标书企业网站建设销售前景
  • wordpress建站教程凌风wordpress 仪表盘 慢
  • 怎样给网站或者商品做推广关于建网站新闻
  • 上海 微信网站 建站一对一直播app
  • ppt模板免费下载网站哪个好克拉玛依市住房和建设局网站
  • 制作网站得多少钱交互设计留学
  • 理财网站免费建设经典重庆新闻论坛
  • 南京专业网站制作哪家好企业所得税交多少
  • 广西网站建设哪家好常熟做网站的
  • 礼品网站制作辽宁省建设部网站
  • 网站群的建设目标澧县网页设计
  • 邯郸网站建设在哪里网站建设yingkagou
  • 姜堰区网站建设企业公司网站制作