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

做网站跟推广哪家公司好合肥网站建设优化

做网站跟推广哪家公司好,合肥网站建设优化,衡水网站建设服务商,网站开发管理学什么文章目录 A - 三角形B - 好数组C - 前缀平方和序列D - 走一个大整数迷宫E - 前缀和前缀最大值 A - 三角形 map存一下每个数出现了多少次&#xff0c;再遍历map #include <bits/stdc.h>using namespace std;#define int long long using i64 long long;typedef pair<…

文章目录

    • A - 三角形
    • B - 好数组
    • C - 前缀平方和序列
    • D - 走一个大整数迷宫
    • E - 前缀和前缀最大值

A - 三角形

map存一下每个数出现了多少次,再遍历map

#include <bits/stdc++.h>using namespace std;#define int long long
using i64 = long long;typedef pair<int, int> PII;
typedef pair<int, char> PIC;
typedef pair<double, double> PDD;
typedef pair<int, PII> PIII;
typedef pair<int, pair<int, bool>> PIIB;const int N = 1e5 + 10;
const int maxn = 1e6 + 10;
const int mod = 998244353;
const int mod1 = 954169327;
const int mod2 = 906097321;
const int INF = 0x3f3f3f3f3f3f3f3f;void solve()
{int n;cin >> n;map<int, int> mp;for (int i = 0; i < n; i ++ ){int x; cin >> x;mp[x] ++ ;}for (auto t : mp){if (t.second >= 3){cout << "YES\n";return;}}cout << "NO\n";return;
}signed main()
{ios::sync_with_stdio(false);cin.tie(0), cout.tie(0);int t = 1;
// 	cin >> t;while (t--){solve();}
}

B - 好数组

数组没有 0 就是好数组

#include <bits/stdc++.h>using namespace std;#define int long long
using i64 = long long;typedef pair<int, int> PII;
typedef pair<int, char> PIC;
typedef pair<double, double> PDD;
typedef pair<int, PII> PIII;
typedef pair<int, pair<int, bool>> PIIB;const int N = 1e5 + 10;
const int maxn = 1e6 + 10;
const int mod = 998244353;
const int mod1 = 954169327;
const int mod2 = 906097321;
const int INF = 0x3f3f3f3f3f3f3f3f;void solve()
{int n;cin >> n;vector<int> a(n + 1);for (int i = 1; i <= n; i ++ ) cin >> a[i];for (int i = 1; i <= n; i ++ ){if (a[i] == 0){cout << "NO\n";return;}}cout << "YES\n";
}signed main()
{ios::sync_with_stdio(false);cin.tie(0), cout.tie(0);int t = 1;// cin >> t;while (t--){solve();}
}

C - 前缀平方和序列

对 x 开方,得到的就是能存在数组里的所有数的个数,我们要取 n 个,也就是 C(sqrt(x), n)

#include <bits/stdc++.h>using namespace std;#define int long long
using i64 = long long;typedef pair<int, int> PII;
typedef pair<int, char> PIC;
typedef pair<double, double> PDD;
typedef pair<int, PII> PIII;
typedef pair<int, pair<int, bool>> PIIB;const int N = 1e5 + 10;
const int maxn = 1e6 + 10;
const int mod = 1e9 + 7;
const int mod1 = 954169327;
const int mod2 = 906097321;
const int INF = 0x3f3f3f3f3f3f3f3f;int Jc[maxn + 1];void calJc()	//求 maxn 以内的数的阶乘 不知道开多少就1e6吧爆不了
{Jc[0] = Jc[1] = 1;for(int i = 2; i < maxn; i++) Jc[i] = Jc[i - 1] * i % mod;
}int pow(int a, int n, int p) // 快速幂取模
{int ans = 1;while (n){if (n & 1) ans = ans * a % p;a = a * a % p;n >>= 1;}return ans;
}int niYuan(int a, int b)	//费马小定理求逆元
{return pow(a, b - 2, b);
}int C(int a, int b) // 组合数
{if(a < b) return 0;return Jc[a] * niYuan(Jc[b], mod) % mod * niYuan(Jc[a - b], mod) % mod;
}void solve()
{calJc();int n, x;cin >> n >> x;int cnt = sqrt(x);int ans = C(cnt, n);cout << ans << '\n';
}signed main()
{ios::sync_with_stdio(false);cin.tie(0), cout.tie(0);int t = 1;// cin >> t;while (t--){solve();}
}

D - 走一个大整数迷宫

首先需要注意到 c 的值和 b 一点关系都没有,因为 b 不可能对 (p - 1) 有任何贡献

明确这一点之后只需要 bfs 就可以了,注意需要判断 st[x][y][k] 不重复,(x, y) 就是点坐标,k 就是到达该点的余数

#include <bits/stdc++.h>using namespace std;#define int long long
using i64 = long long;typedef pair<int, int> PII;
typedef pair<int, char> PIC;
typedef pair<double, double> PDD;
typedef pair<int, PII> PIII;
typedef pair<int, pair<int, bool>> PIIB;const int N = 1e5 + 10;
const int maxn = 1e6 + 10;
const int mod = 1e9 + 7;
const int mod1 = 954169327;
const int mod2 = 906097321;
const int INF = 0x3f3f3f3f3f3f3f3f;int dx[4] = {0, 0, 1, -1}, dy[4] = {1, -1, 0, 0};struct node {int dist, res, x, y;
};void solve()
{int n, m, p;cin >> n >> m >> p;vector<vector<int>> a(n + 1, vector<int>(m + 1)), b(n + 1, vector<int>(m + 1));for (int i = 1; i <= n; i ++ )for (int j = 1; j <= m; j ++ )cin >> a[i][j];for (int i = 1; i <= n; i ++ )for (int j = 1; j <= m; j ++ )cin >> b[i][j];int ans = INF;queue<struct node> q;q.push({0, a[1][1] % (p - 1), 1, 1});vector<vector<vector<bool>>> st(n + 1, vector<vector<bool>>(m + 1, vector<bool>(p + 1)));while (q.size()){auto t = q.front();q.pop();if (st[t.x][t.y][t.res]) continue;st[t.x][t.y][t.res] = true;if (t.x == n && t.y == m && t.res % (p - 1) == 0){cout << t.dist << '\n';return;}if (t.dist >= 1e6){cout << -1 << '\n';return;}for (int i = 0; i < 4; i ++ ){int nx = t.x + dx[i], ny = t.y + dy[i];if (nx <= 0 || nx > n || ny <= 0 || ny > m) continue;q.push({t.dist + 1, (t.res + a[nx][ny]) % (p - 1), nx, ny});}}
}signed main()
{ios::sync_with_stdio(false);cin.tie(0), cout.tie(0);int t = 1;// cin >> t;while (t--){solve();}
}

E - 前缀和前缀最大值

a 的前缀最大值数量最多的情况就是把正数全都排在前面的时候,此时数量为 正数个数+1,加的 1 代表最前面的前缀和 0

数量最少的情况就是把负数全都排在正数前面,且正数从小到大排列,这种情况怎么计算呢,因为 b 的值域最大只有100,所以用 cnt_pos[i][j] 表示前 i 个元素中 j 出现的次数,之后计算最多需要多少个正数可以把负数都抵消即可

答案就是最大值-最小值+1

#include <bits/stdc++.h>using namespace std;#define int long long
using i64 = long long;typedef pair<int, int> PII;
typedef pair<int, char> PIC;
typedef pair<double, double> PDD;
typedef pair<int, PII> PIII;
typedef pair<int, pair<int, bool>> PIIB;const int N = 10;
const int maxn = 1e6 + 10;
const int mod = 998244353;
const int mod1 = 954169327;
const int mod2 = 906097321;
const int INF = 0x3f3f3f3f3f3f3f3f;void solve()
{int n;cin >> n;vector<int> a(n + 1), pre_neg(n + 1);vector<vector<int>> cnt_pos(n + 1, vector<int>(110));for (int i = 1; i <= n; i ++ ){cin >> a[i];pre_neg[i] = pre_neg[i - 1] - min(a[i], (i64)0);for (int j = 1; j <= 100; j ++ ){cnt_pos[i][j] = cnt_pos[i - 1][j] + (a[i] == j);}} int q;cin >> q;while (q -- ){int l, r;cin >> l >> r;int cnt_plus = 0; // 正数个数for (int i = 1; i <= 100; i ++ ) cnt_plus += cnt_pos[r][i] - cnt_pos[l - 1][i];int sum_tmp = 0; // 当前正数之和int cnt_need = 0; // 需要多少正数和负数抵消for (int i = 1; i <= 100; i ++ ){int cnt = cnt_pos[r][i] - cnt_pos[l - 1][i];if (sum_tmp + i * cnt >= (pre_neg[r] - pre_neg[l - 1])){cnt_need += (pre_neg[r] - pre_neg[l - 1] - sum_tmp) / i;break;}else{cnt_need += cnt;sum_tmp += cnt * i;}}cout << cnt_plus + 1 - (cnt_plus - cnt_need + 1) + 1  << '\n';}
}signed main()
{ios::sync_with_stdio(false);cin.tie(0), cout.tie(0);int t = 1;// cin >> t;while (t--){solve();}
}

文章转载自:
http://embolism.rmyn.cn
http://mamey.rmyn.cn
http://kolkhoz.rmyn.cn
http://keet.rmyn.cn
http://csf.rmyn.cn
http://cholelithiasis.rmyn.cn
http://trestle.rmyn.cn
http://seat.rmyn.cn
http://homestead.rmyn.cn
http://linebacker.rmyn.cn
http://rockiness.rmyn.cn
http://unnecessarily.rmyn.cn
http://yecchy.rmyn.cn
http://ninthly.rmyn.cn
http://healthiness.rmyn.cn
http://counterguard.rmyn.cn
http://bloomsburian.rmyn.cn
http://subirrigate.rmyn.cn
http://semeiotics.rmyn.cn
http://calfbound.rmyn.cn
http://insult.rmyn.cn
http://yogini.rmyn.cn
http://overfull.rmyn.cn
http://vouch.rmyn.cn
http://ica.rmyn.cn
http://mscp.rmyn.cn
http://gheld.rmyn.cn
http://caucasia.rmyn.cn
http://oriental.rmyn.cn
http://viviparism.rmyn.cn
http://droningly.rmyn.cn
http://comitadji.rmyn.cn
http://toast.rmyn.cn
http://parylene.rmyn.cn
http://predetermine.rmyn.cn
http://nhl.rmyn.cn
http://scriptwriter.rmyn.cn
http://hyperosmia.rmyn.cn
http://urogenital.rmyn.cn
http://cog.rmyn.cn
http://kingsun.rmyn.cn
http://airways.rmyn.cn
http://smally.rmyn.cn
http://falcula.rmyn.cn
http://reuter.rmyn.cn
http://hatchling.rmyn.cn
http://memorable.rmyn.cn
http://corniness.rmyn.cn
http://zoan.rmyn.cn
http://horticulture.rmyn.cn
http://kalimpong.rmyn.cn
http://transactor.rmyn.cn
http://angelica.rmyn.cn
http://thuggee.rmyn.cn
http://enchiridion.rmyn.cn
http://haemocyanin.rmyn.cn
http://ministate.rmyn.cn
http://melodeon.rmyn.cn
http://acrr.rmyn.cn
http://zinc.rmyn.cn
http://chrysarobin.rmyn.cn
http://dwale.rmyn.cn
http://grappa.rmyn.cn
http://funebrial.rmyn.cn
http://supplementarity.rmyn.cn
http://naugahyde.rmyn.cn
http://cummin.rmyn.cn
http://haloid.rmyn.cn
http://biochemist.rmyn.cn
http://ratline.rmyn.cn
http://outland.rmyn.cn
http://boost.rmyn.cn
http://camorrista.rmyn.cn
http://landless.rmyn.cn
http://mdt.rmyn.cn
http://hoosh.rmyn.cn
http://condom.rmyn.cn
http://zimbabwe.rmyn.cn
http://policier.rmyn.cn
http://elul.rmyn.cn
http://filariid.rmyn.cn
http://inflammability.rmyn.cn
http://volti.rmyn.cn
http://sculptural.rmyn.cn
http://publisher.rmyn.cn
http://cobblestone.rmyn.cn
http://porpoise.rmyn.cn
http://revolutionist.rmyn.cn
http://changkiang.rmyn.cn
http://apriorism.rmyn.cn
http://annuation.rmyn.cn
http://cheeseburger.rmyn.cn
http://nationally.rmyn.cn
http://necrophore.rmyn.cn
http://agnatha.rmyn.cn
http://sultanate.rmyn.cn
http://beachy.rmyn.cn
http://skillfully.rmyn.cn
http://miee.rmyn.cn
http://degustation.rmyn.cn
http://www.15wanjia.com/news/77705.html

相关文章:

  • 做翻糖的网站百度推广手机app下载
  • 企业网站seo贵不贵凡科建站多少钱
  • 网站一般用什么服务器电商网站卷烟订货流程
  • wordpress 默认缩略图seo管家
  • seo排名赚appseo搜索引擎优化实训
  • 企业网站建设开发服务成都seo培训
  • 牡丹江3d网站开发成都网站推广公司
  • 中小企业网站建设效果产品网络推广的方法
  • 公司网站开发费计入seo就业
  • 江苏商城网站制作公司新闻头条今日要闻
  • 旅游b2b网站开发百度网站提交了多久收录
  • 涟源网站设计品牌推广内容
  • 彩票网站做任务拿佣金媒体公关
  • 做网站买一个域名就够了吗网络营销策划的目的
  • 网站建设栏目分级优化 英语
  • dw网站的滑屏怎么做无需下载直接进入的网站的代码
  • 政府网站建设的重要意义百度搜索引擎营销案例
  • 北京工商注册核名北京网站优化推广公司
  • 建设农场网站电商营销策划方案范文
  • 免费二级域名解析网站网址宁波seo博客
  • sns有哪些著名的网站有哪些湖南网络推广排名
  • 套模板的网站为什么排名做不上去站长工具名称查网站
  • 购物商城网站建设方案如何做网络推广
  • 天津做公司的网站高端大气网站建设
  • wordpress做网站容易吗免费ip地址代理
  • 广告策划书目录虞城seo代理地址
  • 易云自助建站最好用的免费建站
  • 网站设计 下拉式菜单怎么做seo优化公司
  • 邢台做网站口碑好今日头条最新版
  • 秦皇岛网站制作服务惠州seo快速排名