【A:LCM】

  1. #include<bits/stdc++.h>
  2. using namespace std;
  3. #define ll long long
  4. int main()
  5. {
  6. ll a,b,g;
  7. cin>>a>>b;
  8. g=__gcd(a,b);
  9. cout<<a/g*b<<endl;
  10. return ;
  11. }

【B:STL,用set或者queue+map都行】

  1. #include<bits/stdc++.h>
  2. using namespace std;
  3. #define ll unsigned long long
  4. const int maxn=;
  5. const ll inf=1e18;
  6. ll a[maxn]; int cnt;
  7. set<ll>s;
  8. void solve()
  9. {
  10. s.insert(); s.insert(); s.insert();
  11. while(!s.empty()){
  12. ll now=*s.begin();
  13. a[++cnt]=now; s.erase(s.begin());
  14. if(now*<=inf) s.insert(now*);
  15. if(now*<=inf) s.insert(now*);
  16. if(now*<=inf) s.insert(now*);
  17. }
  18. }
  19. int main()
  20. {
  21. solve();
  22. int T; ll N;
  23. scanf("%d",&T);
  24. while(T--){
  25. scanf("%lld",&N);
  26. int pos=lower_bound(a+,a+cnt+,N)-a;
  27. printf("%lld\n",a[pos]);
  28. }
  29. return ;
  30. }

【C:贪心水题】

  1. #include<bits/stdc++.h>
  2. using namespace std;
  3. const int maxn=;
  4. int a[maxn];
  5. int main()
  6. {
  7. int N,M,i,j,ans=;
  8. scanf("%d%d",&N,&M);
  9. for(i=;i<=N;i++) scanf("%d",&a[i]);
  10. sort(a+,a+N+);
  11. j=;
  12. for(i=N;i>=j;i--){
  13. if(i!=j&&a[i]+a[j]<=M) j++;
  14. ans++;
  15. }
  16. printf("%d\n",ans);
  17. return ;
  18. }

【D:暴力求得每个数的因子,复杂度O(Nsqrrt(N))】

  1. #include<bits/stdc++.h>
  2. using namespace std;
  3. const int maxn=;
  4. int num[maxn];
  5. int main()
  6. {
  7. int N,x,i,j,ans=;
  8. scanf("%d",&N);
  9. for(i=;i<=N;i++){
  10. scanf("%d",&x);
  11. for(j=;j*j<=x;j++){
  12. if(x%j==){
  13. num[j]++; if(num[j]>) ans=max(ans,j);
  14. if(j*j!=x) {
  15. num[x/j]++; if(num[x/j]>) ans=max(ans,x/j);
  16. }
  17. }
  18. }
  19. }
  20. printf("%d\n",ans);
  21. return ;
  22. }

【E:区间DP,和前天那个有点像】

  1. #include<bits/stdc++.h>
  2. using namespace std;
  3. #define ll long long
  4. const int maxn=;
  5. ll sum[maxn][maxn];
  6. int ans,x;
  7. int main()
  8. {
  9. int N,M,i,j,k;
  10. while(~scanf("%d%d",&M,&N)){
  11. ans=;
  12. for(i=;i<=N;i++)
  13. for(j=;j<=M;j++)
  14. scanf("%d",&x),sum[i][j]=sum[i-][j]+x;
  15. for(i=;i<=N;i++)
  16. for(j=i;j<=N;j++){
  17. int tmp=;
  18. for(k=;k<=M;k++){
  19. tmp+=sum[j][k]-sum[i-][k];
  20. if(tmp<) tmp=;
  21. if(tmp>ans) ans=tmp;
  22. }
  23. }
  24. printf("%d\n",ans);
  25. }
  26. return ;
  27. }

【F:KMP】

请先自学吧。

【CQ18高一暑假前挑战赛3】标程的更多相关文章

  1. 【CQ18高一暑假前挑战赛5】标程

    [A:暴力] #include<bits/stdc++.h> using namespace std; ; int a[maxn],vis[maxn],N,M; int main() { ...

  2. 【CQ18高一暑假前挑战赛4】标程

    [二分或者STL] 二分: #include<bits/stdc++.h> using namespace std; ; int a[maxn]; int main() { ,pos; s ...

  3. 【CQ18高一暑假前挑战赛3.5】标程

    [A:快速幂相关] #include<bits/stdc++.h> using namespace std; int qpow(int a,int x){ a%=;; while(x){ ...

  4. 【CQ18高一暑假前挑战赛2】标程

    [昨晚打校赛,5个小时打完很累了,所以搞忘出题了...对不起学弟们,不过出的题都亲自写过一遍,可以保证题目和代码长度都不长,题目难度不大] [A:bush博弈] #include<bits/st ...

  5. 【CQ18高一暑假前挑战赛1】标程

    [A] #include<bits/stdc++.h> using namespace std; #define ll long long ll qpow(ll a,ll x,ll Mod ...

  6. [转]关于一些SPFA的标程

    SPFA算法 求单源最短路的SPFA算法的全称是:Shortest Path Faster Algorithm. 最短路径快速算法-SPFA算法是西南交通大学段凡丁于1994年发表的. 适用范围:给定 ...

  7. [求助][SPOJ MARIOGAM]-高斯消元(内含标程,数据等)

    小蒟蒻开始做概率的题之后,遇到了这道题,然而,他发现自己的程序调试了无数次也无法通过,系统总是返回令人伤心的WA, 于是,他决定把这一天半的时间收集到的资料放在网上, 寻求大家的帮助, 也可以节省后来 ...

  8. hdu6435 Problem J. CSGO标程讲解以及改正标程的一个错误(本来第一个样例过不了2333) 以及 poj2926 五维曼哈顿距离模板

    比赛的时候抄poj2926的模板,但改不来啊orz #include <iostream> #include <cstdio> #include <cstring> ...

  9. 暑假前的flag

    暑假到了,为了简便新开了一个博客,供暑假刷体放一些题解,玩acm1年多了,cf还是蓝名,真是菜的一笔,明年就大三了,马上就要毕业了,然而还是啥也不会,兼职和智障没什么两样,当初大一吹的牛逼说要成为学校 ...

随机推荐

  1. PS 抠图如何使用通道法处理头发

      通道抠图法抠出美女飘逸头发-PS抠图实例教程 抠图更换背景后效果图 通道抠图法抠出美女飘逸头发-PS抠图实例教程 教程步骤: 1  打开原图,进入通道面板. 通道抠图法抠出美女飘逸头发-PS抠图实 ...

  2. C#自定义类型数组排序

    在数组或者集合中对自定义类型进行排序分为两种方法. 1.如果这个自定义类型是自己定义编写的,那么我可以使它继承ICompareable<T>接口,实现其中的CompareTo(Object ...

  3. JavaScript插件编写指南

    在编写插件之前,大家要先了解做插件的几个要点: 插件需要满足的条件 一个可复用的插件需要满足以下条件: 插件自身的作用域与用户当前的作用域相互独立,也就是插件内部的私有变量不能影响使用者的环境变量: ...

  4. 新建 .NET Core 控制台项目 C# 数组深拷贝

    新建 .NET Core 控制台项目 1. 安装 .NET Core SDK 1.0 参考微软官方网站 https://www.microsoft.com/net/download/windows 2 ...

  5. 基于tornado实现的web聊天室

    目录结构: # -*- coding:utf-8 -*- import uuid import json import tornado.ioloop import tornado.web import ...

  6. Sum It Up POJ 1564 HDU 杭电1258【DFS】

    Problem Description Given a specified total t and a list of n integers, find all distinct sums using ...

  7. EasyDarwin开源流媒体服务器支持basic基本认证和digest摘要认证解析

    本文转自EasyDarwin开源团队成员ss的博客:http://blog.csdn.net/ss00_2012/article/details/52262621 RTSP认证作为RTSP标准协议的一 ...

  8. c/c++标准库中的文件操作总结

    1 stdio.h是c标准库中的标准输入输出库 2 在c++中调用的方法 直接调用即可,但是最好在函数名前面加上::,以示区分类的内部函数和c标准库函数. 3 c标准输入输出库的使用 3.1 核心结构 ...

  9. 支付宝cookie 是支付密码 不是登录密码

    开发文档/ 手机网站支付 / 产品介绍 开放平台文档中心 https://docs.open.alipay.com/203/105288

  10. Delphi快捷键大全

    Delphi快捷键大全 在过程.函数.事件内部, SHIFT+CTRL+向上的方向键 可跳跃到相应的过程.函数.事件的定义.相反,在过程.函数.事件的定义处,SHIFT+CTRL+向下的方向键 可跳跃 ...