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

济南网站建设团队快速做网站

济南网站建设团队,快速做网站,南京小程序定制开发,西安哪家做网站最好备战蓝桥杯#xff08;java#xff09;#xff08;日益更新#xff09; 文章目录 备战蓝桥杯#xff08;java#xff09;#xff08;日益更新#xff09;前言#xff1a;一、c 到 java 须要注意的地方#xff1a;二、多练java代码#xff1a;#xff08;用java代码…备战蓝桥杯java日益更新 文章目录 备战蓝桥杯java日益更新前言一、c 到 java 须要注意的地方二、多练java代码用java代码写算法模版1. acwing1277 分巧克力2. acwing5407 管道3. acwing562 壁画4. acwing1230 K倍区间5. acwing4262 空调6. acwing5396 棋盘 总结 前言 将 c 代码 转换为 java 代码 提示以下是本篇文章正文内容 一、c 到 java 须要注意的地方 java中如何实现像c那样typedef long long LLjava中如何实现像c那样const int N 1e5 10;java中如何实现像c那样int n, m; int h[N], w[N];java中如何实现像c那样scanf(“%d%d”, n, m);java中如何实现像c那样#define x first #define y second typedef pairint, int PII;java中如何实现像c那样int l max(1, L - t), r min((LL)m, (LL)L t);java中如何实现像c那样sort(q, qcnt)java中如何实现像c那样 bool check(int mid)java中如何实现像c那样for(int i 0; i n; i ) scanf(“%d%d”, h[i], w[i]);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 #16 4 9583 Case #214 3 616 Case #37 10 1029384756 Case #431*/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://www.hkea.cn/news/14257315/

相关文章:

  • wordpress菜谱网站新津县建设局网站
  • 公司做哪个网站比较好做网站谈单
  • 企业为何选择网站推广外包?电脑上wap网站
  • 深圳市外贸网站Linux哪个版本做网站好
  • 网站开发可行性企业网站建设规划的基本原则有哪些
  • 做美团团购网站用那种语言做网站比较好
  • 企业免费建网站绵阳市建设银行网站
  • 网站建设备案优化之看WordPress文章设置时间免费
  • 关于棋牌游戏网站建设文案做文学类网站后期花费
  • 文化传媒可以做网站吗怎样在亚马逊上开自己的店铺
  • 盐城经济技术开发区建设局网站国外虚拟主机 两个网站
  • 网业公司搜索引擎优化seo课程总结
  • 做公众号必了解的网站做网站租服务器多少钱
  • 网站搜索优化找哪家活动策划案模板
  • 做代练去什么网站安全吗东莞网站建设方案
  • wordpress 首页打开慢青岛seo推广专员
  • 鲜花商城网站设计艺术网页设计欣赏
  • 网站开发素材新手网页设计教程
  • 完整的网站开发流程江苏seo推广网站建设
  • 视频网站程序俱乐部网站方案
  • 网站做第三方登录网站空间ip
  • 杭州便宜的手机网站建设深圳住房和建设局网站官网
  • 微信制作软件百度网站优化排名
  • 厦门网站建设团队网站建设包括哪方面
  • 深圳官方网站建设二维码生成在线制作
  • 网站怎么seo河北网站开发网站
  • 手机上搭建个人网站手机网站页面布局
  • 谁做彩票网站代理网上国网下载
  • 惠城区城乡规划建设局网站自动制作视频的软件
  • 嘉兴秀宏建设公司网站外贸公司网站建设哪家好