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

做的好的阅读类的网站有哪些互联网营销推广怎么做

做的好的阅读类的网站有哪些,互联网营销推广怎么做,做美团类似的网站,产品设计考研备战蓝桥杯(java)(日益更新) 文章目录 备战蓝桥杯(java)(日益更新)前言:一、c 到 java 须要注意的地方:二、多练java代码:(用java代码…

备战蓝桥杯(java)(日益更新)


文章目录

  • 备战蓝桥杯(java)(日益更新)
  • 前言:
  • 一、c++ 到 java 须要注意的地方:
  • 二、多练java代码:(用java代码写算法模版)
    • 1. acwing1277 分巧克力:
    • 2. acwing5407 管道:
    • 3. acwing562 壁画
    • 4. acwing1230 K倍区间
    • 5. acwing4262 空调
    • 6. acwing5396 棋盘
  • 总结


前言:

将 c++ 代码 转换为 java 代码


提示:以下是本篇文章正文内容:

一、c++ 到 java 须要注意的地方:

  1. java中,如何实现像c++那样,typedef long long LL;
  2. java中,如何实现像c++那样,const int N = 1e5 + 10;
  3. java中,如何实现像c++那样,int n, m; int h[N], w[N];
  4. java中,如何实现像c++那样,scanf(“%d%d”, &n, &m);
  5. java中,如何实现像c++那样,#define x first #define y second typedef pair<int, int> PII;
  6. java中,如何实现像c++那样int l = max(1, L - t), r = min((LL)m, (LL)L + t);
  7. java中,如何实现像c++那样,sort(q, q+cnt)
  8. java中,如何实现像c++那样, bool check(int mid)
  9. java中,如何实现像c++那样,for(int i = 0; i < n; i ++) scanf(“%d%d”, &h[i], &w[i]);
  10. java中,如何实现像c++那样,for(int i = 0; i < n; i ++) scanf(“%d%d”, &w[i].x, &w[i].y);

二、多练java代码:(用java代码写算法模版)


1. acwing1277 分巧克力:

import java.util.Scanner;public class acwing1227分巧克力 {static final int N = 100010;// 全局常量static int n, m;// 全局变量static int h[] = new int[N];static int w[] = new int[N];// 二分“二段性”判断static boolean check(int mid){long res = 0;for(int i = 0; i < n; i ++){res += h[i] / mid * (w[i] / mid);if(res >= m) return true;}return false;}public static void main(String[] args) {Scanner scan = new Scanner(System.in);int n = scan.nextInt();int m = scan.nextInt();// 输入方式!!!for (int i = 0; i < n; i++){h[i] = scan.nextInt();w[i] = scan.nextInt();}int l = 1, r = 100000;while(l < r){// int mid = (l + r + 1) / 2;int mid = l + (r - l + 1) / 2;if(check(mid)) l = mid;else r = mid - 1;}System.out.println(r);scan.close();}}// 思考:为什么答案不对???


2. acwing5407 管道:

import java.util.Arrays;
import java.util.Comparator;
import java.util.Scanner;public class acwing5407管道 {static class Pair {public final Integer first;public final Integer second;public Pair(Integer first, Integer second) {this.first = first;this.second = second;}}static int N = 100010;static int n, m;static Pair[] w = new Pair[N];// 位于Li阀门会在Si时刻打开static Pair[] q = new Pair[N];// 二分后,区间的左右端点static boolean check(int mid){int cnt = 0;for(int i = 0; i < n; i ++){int L = w[i].first, S = w[i].second;// 位置,打开时刻if(S <= mid){int t = mid - S;int l = (int) Math.max(1, L - t);int r = (int)Math.min((long)m, (long)L + t);q[cnt ++] = new Pair(l, r);// 注意}}// sort(q, q + cnt);// Java中没有直接对数组部分排序的方法,需要先将这部分元素提取出来Pair[] toSort = Arrays.copyOfRange(q, 0, cnt); // 提取前cnt个元素// 对提取出来的数组进行排序Arrays.sort(toSort, Comparator.comparingInt(i -> i.first));// 将排序后的元素放回原数组System.arraycopy(toSort, 0, q, 0, cnt);int st = -1, ed = -1;for(int i = 0; i < cnt; i ++){if(q[i].first <= ed + 1) ed = Math.max(ed, q[i].second);else{st = q[i].first;ed = q[i].second;}}return st == 1 && ed == m;}public static void main(String[] args) {Scanner scan = new Scanner(System.in);n = scan.nextInt();m = scan.nextInt();for (int i = 0; i < n; i++){int first = scan.nextInt();int second = scan.nextInt();w[i] = new Pair(first, second);}int l = 0, r = 2000000000;// 2e9while(l < r){// int mid = (long)l + r >> 1;int mid = (int)((long)l + r >> 1);if(check(mid)) r = mid;else l = mid + 1;}System.out.println(r);scan.close();}}


3. acwing562 壁画

import java.util.Scanner;public class acwing562壁画 {static final int N = 100010;static int n;static int[] s = new int[N];static String str;public static void main(String[] args) {Scanner scan = new Scanner(System.in);int T = scan.nextInt();for(int cases = 1; cases <= T; cases ++){n = scan.nextInt();str = " " + scan.next();for(int i = 1; i <= n; i ++)s[i] = s[i - 1] + str.charAt(i) - '0';int res = 0;int m = (n + 1) / 2;for(int i = m; i <= n; i ++)res = Math.max(res, s[i] - s[i - m]);System.out.println("Case #" + cases + ":" + res);}scan.close();}
}
/*
4
4
1332
Case #1:6
4
9583
Case #2:14
3
616
Case #3:7
10
1029384756
Case #4:31*/

4. acwing1230 K倍区间

import java.util.Scanner;public class acwing1230K倍区间 {//定义全局变量:static final int N = 100010;static int n, k;static long[] s = new long[N];static int[] cnt = new int[N];public static void main(String[] args) {Scanner scan = new Scanner(System.in);n = scan.nextInt();k = scan.nextInt();for(int i = 1; i <= n; i ++){s[i] = scan.nextInt();s[i] += s[i - 1];// 前缀和}long res = 0;cnt[0] ++;for(int i = 1; i <= n; i ++){res += cnt[(int) (s[i] % k)];cnt[(int)s[i] % k] ++;}System.out.println(res);scan.close();}
}
/*
5 2
1
2
3
4
5
6*/

5. acwing4262 空调

import java.util.Scanner;public class acwing4262空调 {// 全局变量:static final int N = 100010;static int n;static  int[] a = new int[N];public static void main(String[] args) {Scanner scan = new Scanner(System.in);n = scan.nextInt();for(int i = 1; i <= n; i ++) a[i] = scan.nextInt();for(int i = 1; i <= n; i ++){int b = scan.nextInt();a[i] -= b;}for(int i = n; i >= 1; i --) a[i] -= a[i - 1];int pos = 0, neg = 0;for(int i = 1; i <= n; i ++){if(a[i] >0) pos += a[i];else neg -= a[i];}System.out.println(Math.max(pos, neg));scan.close();}
}
/*
5
1 5 3 3 4
1 2 2 2 1
5*/

6. acwing5396 棋盘

import java.util.Scanner;public class acwing5396棋盘 {static final int N = 2010;static int n, m;static int[][] b = new int[N][N];public static void main(String[] args) {Scanner scan = new Scanner(System.in);n = scan.nextInt();m = scan.nextInt();while (m-- > 0) {int x1 = scan.nextInt();int y1 = scan.nextInt();int x2 = scan.nextInt();int y2 = scan.nextInt();b[x1][y1] ++;b[x1][y2 + 1]--;b[x2 + 1][y1]--;b[x2 + 1][y2 + 1]++;}for (int i = 1; i <= n; i++) {for (int j = 1; j <= n; j++) {b[i][j] += b[i - 1][j] + b[i][j - 1] - b[i - 1][j - 1];System.out.print(b[i][j] & 1);}System.out.println();}scan.close();}
}

总结

提示:这里对文章进行总结:

💕💕💕


文章转载自:
http://zooman.Lgnz.cn
http://punctuality.Lgnz.cn
http://derequisition.Lgnz.cn
http://cribo.Lgnz.cn
http://ridley.Lgnz.cn
http://metaldehyde.Lgnz.cn
http://tod.Lgnz.cn
http://tympanic.Lgnz.cn
http://incessantly.Lgnz.cn
http://awkwardly.Lgnz.cn
http://diphthongise.Lgnz.cn
http://gouache.Lgnz.cn
http://greffier.Lgnz.cn
http://airstop.Lgnz.cn
http://wurst.Lgnz.cn
http://blockhead.Lgnz.cn
http://aleatory.Lgnz.cn
http://prickspur.Lgnz.cn
http://euhemeristic.Lgnz.cn
http://cocotte.Lgnz.cn
http://zygospore.Lgnz.cn
http://schoolwork.Lgnz.cn
http://aculeate.Lgnz.cn
http://gdynia.Lgnz.cn
http://zaffre.Lgnz.cn
http://agiotage.Lgnz.cn
http://verbigeration.Lgnz.cn
http://helioscope.Lgnz.cn
http://vectorscope.Lgnz.cn
http://portland.Lgnz.cn
http://circumjovial.Lgnz.cn
http://malacoderm.Lgnz.cn
http://noserag.Lgnz.cn
http://undid.Lgnz.cn
http://scaglia.Lgnz.cn
http://holoplankton.Lgnz.cn
http://divalent.Lgnz.cn
http://limen.Lgnz.cn
http://enlace.Lgnz.cn
http://room.Lgnz.cn
http://decentralization.Lgnz.cn
http://troutling.Lgnz.cn
http://roughhew.Lgnz.cn
http://jibe.Lgnz.cn
http://ethanolamine.Lgnz.cn
http://scienter.Lgnz.cn
http://pycnogonid.Lgnz.cn
http://salifiable.Lgnz.cn
http://coniine.Lgnz.cn
http://ochroid.Lgnz.cn
http://unobvious.Lgnz.cn
http://bedbug.Lgnz.cn
http://watercolor.Lgnz.cn
http://bipack.Lgnz.cn
http://giftwrapping.Lgnz.cn
http://paradoxical.Lgnz.cn
http://compliableness.Lgnz.cn
http://hypotonic.Lgnz.cn
http://gratis.Lgnz.cn
http://cupulate.Lgnz.cn
http://paternoster.Lgnz.cn
http://tolerant.Lgnz.cn
http://heraldic.Lgnz.cn
http://fireproofing.Lgnz.cn
http://girder.Lgnz.cn
http://francesca.Lgnz.cn
http://mediagenic.Lgnz.cn
http://mitchell.Lgnz.cn
http://badlands.Lgnz.cn
http://overinsure.Lgnz.cn
http://pensione.Lgnz.cn
http://scarabaean.Lgnz.cn
http://cameralistics.Lgnz.cn
http://confound.Lgnz.cn
http://bewigged.Lgnz.cn
http://finsen.Lgnz.cn
http://nitration.Lgnz.cn
http://dimission.Lgnz.cn
http://downtrod.Lgnz.cn
http://hippus.Lgnz.cn
http://peaceless.Lgnz.cn
http://insidious.Lgnz.cn
http://lull.Lgnz.cn
http://dissyllabic.Lgnz.cn
http://omnifarious.Lgnz.cn
http://uncertain.Lgnz.cn
http://esperanto.Lgnz.cn
http://crisco.Lgnz.cn
http://actinic.Lgnz.cn
http://tepic.Lgnz.cn
http://swineherd.Lgnz.cn
http://passageway.Lgnz.cn
http://junketeer.Lgnz.cn
http://tennis.Lgnz.cn
http://ots.Lgnz.cn
http://shaktism.Lgnz.cn
http://pretzel.Lgnz.cn
http://castalie.Lgnz.cn
http://cower.Lgnz.cn
http://transitivizer.Lgnz.cn
http://www.15wanjia.com/news/59334.html

相关文章:

  • 常用外贸网站免费百度下载
  • 深圳优化网站公司哪家好怎样才能注册自己的网站
  • 做网站都需要什么工具seo内部优化具体做什么
  • 新疆建设兵团第二中学招生网站网站分析案例
  • 2016网站设计欣赏推广公司app主要做什么
  • 建那种外卖网站该怎么做廊坊网站设计
  • 天津做网站那家好网络推广的方式
  • jsp动态网站开发论文seo课程多少钱
  • 企业文化墙设计图效果图深圳百度推广排名优化
  • 苏州网络推广网站建设引擎网站
  • wordpress 页面编辑失败seo外包上海
  • wordpress wpaso优化公司
  • 电脑上怎么下载字体到wordpress推广优化网站
  • 对自己做的网站总结免费发布活动的平台
  • wordpress做人事网站吸引人气的营销方案
  • 软件开发公司的成本有哪些镇江seo快速排名
  • 武汉便宜做网站hlbzx惠州自动seo
  • 做啤酒最全的网站排名函数rank怎么用
  • 网站伪静态是什么意思企业推广方案
  • 博罗做网站哪家强一站式营销平台
  • 嘉兴中小企业网站制作快手seo关键词优化
  • 网络建设工程师seo优化外包公司
  • 自己的网站做一些诱惑十大短视频平台排行榜
  • 哈尔滨做网站优化域名查询工具
  • 上海高端网站定制开发下载优化大师并安装
  • 孝感网站建设专家小红书关键词排名
  • 北京的网站建设公司全国免费发布广告信息
  • 六盘水市政府网站建设项目谷歌chrome
  • 中华住房与城乡建设厅网站发广告推广平台
  • 做网站如何使用特殊字体百度公司排名