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

wordpress rss 订阅哈尔滨网站优化

wordpress rss 订阅,哈尔滨网站优化,工程建设科学技术奖申报网站,华人精品网站建设Problem - C - Codeforces 题意: 思路: 思路很简单,只删除一种,直接枚举删除的是哪一种即可 但是回文子序列的判定我vp的时候写的很答辩,也不知道为什么当时要从中间往两边扫,纯纯自找麻烦 然后就越改越…

Problem - C - Codeforces

题意:

 

思路:

思路很简单,只删除一种,直接枚举删除的是哪一种即可

但是回文子序列的判定我vp的时候写的很答辩,也不知道为什么当时要从中间往两边扫,纯纯自找麻烦

然后就越改越复杂,两小时的时候才过C

所以有新想法的时候还是把new idea整合一下,再去写代码

直接从两边往中间扫就行了,然后把该删的都删掉

Code:

#include <bits/stdc++.h>#define int long longusing i64 = long long;using namespace std;const int N = 2e5 + 10;
const int M = 3e6 + 10;
const int P = 131;void solve() {int n;    string s;cin >> n >> s;s = " " + s;set<char> S;for (int i = 1; i <= n; i ++) {S.insert(s[i]);}int ans = 1e9;for(auto c: S) {int l = 1, r = n;int cnt = 0;while(l <= r) {if (s[l] == s[r]) {l ++;r --;}else if (s[l] == c) {cnt ++;l ++;}else if (s[r] == c) {cnt ++;r --;}else {cnt = 1e9;break;}}ans = min(ans, cnt);}if (ans == 1e9) {cout << -1 << "\n";}else {cout << ans << "\n";}
}
signed main(){ios::sync_with_stdio(false);cin.tie(nullptr);int t = 1;cin >> t;while(t --) {solve();}return 0;
}

 

Problem - D - Codeforces

题意:

思路:

构造题,看样例发现什么都看不出来

先去考虑特殊的情况

如果N = 2,那么

a * x + b * y = 0

x = - b

y = a 

如果N = 3

有三种情况,以一种举例:

x = - c

y = - c

z = a + b

当然这里的c和-c可以替换成b和-b,a和-a,所以是三种情况

然后考虑将特殊情况“组合”到一般情况中去

可以发现,如果n是奇数,那么就分组成3+2+2+2+....的形式

否则就可以是2+2+2+....的形式

这样就做完了

这道题的启发是:可以用特殊情况“组合”成一般情况进行考虑

Code:

#include <bits/stdc++.h>#define int long longusing i64 = long long;using namespace std;const int N = 2e5 + 10;
const int M = 3e6 + 10;
const int P = 131;int a[N], b[N];void solve() {int n;cin >> n;for (int i = 1; i <= n; i ++) {cin >> a[i];}if (n % 2 == 1) {if (a[1] + a[3]) {b[1] = -a[2];b[3] = -a[2];b[2] = a[1] + a[3];}else if (a[1] + a[2]) {b[1] = -a[3];b[2] = -a[3];b[3] = a[1] + a[2];}else if (a[2] + a[3]) {b[2] = -a[1];b[3] = -a[1];b[1] = a[2] + a[3];}for (int i = 4; i <= n; i += 2) {b[i] = -a[i + 1];b[i + 1] = a[i];}}else {for (int i = 1; i <= n; i += 2) {b[i] = -a[i + 1];b[i + 1] = a[i];}}for (int i = 1; i <= n; i ++) {cout << b[i] << " \n" [i == n];}
}
signed main(){ios::sync_with_stdio(false);cin.tie(nullptr);int t = 1;cin >> t;while(t --) {solve();}return 0;
}

http://www.tj-hxxt.cn/news/32319.html

相关文章:

  • 制作一个专门浏览图片的网站优化技术
  • 郑州虚拟货币网站开发哪家公司建设网站好
  • 创意广告视频网站百度seo关键词报价
  • 国家市场监督管理总局网站seo推广优化公司哪家好
  • 网站开发背景和目的小程序制作一个需要多少钱
  • wordpress网站备案号游戏推广在哪里接活
  • 陈坤做直播在哪个网站优化网站排名技巧
  • 深圳做网站 信科便宜网络营销的新特点
  • 成都科技网站建设咨询电话网络营销八大工具
  • 做背景视频哪个网站好近期国内新闻
  • 做网站外包最牛的公司网站建设百度推广
  • 我想买个空间自己做网站高明搜索seo
  • 经典网站欣赏、推广营销app
  • 怎么做电商网站重要新闻今天8条新闻
  • 做公司网站建设价格南京网站设计公司
  • 销售机械设备做网站网络营销的定义
  • 上饶做网站要多少钱私人网站服务器
  • 刚做网站做多用户还是单用户珠海百度关键字优化
  • 目前网站开发 用java 还是phpseo公司哪家好用
  • 如何分析一个网站做的怎么样管理培训
  • 网站后台登陆验证码东莞seo优化推广
  • 京东商城网站的搜索引擎营销做的案例分析天津谷歌优化
  • 郑州网站建设公司招聘seo外链代发
  • 请稍后重试(3008)排名优化是怎么做的
  • 机械类网站模板长沙有实力的关键词优化价格
  • 拍卖网站开发线上营销推广方式
  • 域名做网站自己的电脑网站排名推广工具
  • 亿网中国网站管理系统seo入门教程网盘
  • 网站维护工作台湾搜索引擎
  • 优化网站排名方法教程站长工具果冻传媒