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

厦门营销网站建设公司新网站百度收录

厦门营销网站建设公司,新网站百度收录,欧阳娜娜自创品牌,南昌建站目录 题目地址 做题情况 A 题 B 题 C 题 D 题 E 题 F 题 牛客竞赛主页 题目地址 牛客竞赛_ACM/NOI/CSP/CCPC/ICPC算法编程高难度练习赛_牛客竞赛OJ 做题情况 A 题 输出两个不是同一方位的字符中的任意一个就行 import java.io.*; import java.math.*; import java…

目录

题目地址

做题情况

A 题

B 题

C 题

D 题

E 题

F 题

牛客竞赛主页

题目地址

牛客竞赛_ACM/NOI/CSP/CCPC/ICPC算法编程高难度练习赛_牛客竞赛OJ

做题情况

A 题

输出两个不是同一方位的字符中的任意一个就行

import java.io.*;
import java.math.*;
import java.util.*;public class Main {static IOS sc=new IOS();static final int MOD = 998244353;public static void solve() throws IOException {char a=sc.nextChar();if(a=='U'||a=='D') {dduoln('L');}else {dduoln('U');}}public static void main(String[] args) throws Exception {int t = 1;
//        t = sc.nextInt();while (t-- > 0) {solve();}}static <T> void dduo(T t) {System.out.print(t);}static <T> void dduoln(T t) {System.out.println(t);}}class IOS{BufferedReader bf;StringTokenizer st;BufferedWriter bw;public IOS(){bf=new BufferedReader(new InputStreamReader(System.in));st=new StringTokenizer("");bw=new BufferedWriter(new OutputStreamWriter(System.out));}public String nextLine() throws IOException{return bf.readLine();}public String next() throws IOException{while(!st.hasMoreTokens()){st=new StringTokenizer(bf.readLine());}return st.nextToken();}public char nextChar() throws IOException{return next().charAt(0);}public int nextInt() throws IOException{return Integer.parseInt(next());}public long nextLong() throws IOException{return Long.parseLong(next());}public double nextDouble() throws IOException{return Double.parseDouble(next());}public float nextFloat() throws IOException{return Float.parseFloat(next());}public BigInteger nextBigInteger() throws IOException{return new BigInteger(next());}public BigDecimal nextDecimal() throws IOException{return new BigDecimal(next());}
}

B 题

可以稍微贪心一下

构造 1 2 1 2 1 2 1 2 1 2

import java.io.*;
import java.math.*;
import java.util.*;public class Main {static IOS sc=new IOS();static final int MOD = 998244353;public static void solve() throws IOException {int n=sc.nextInt();for(int i=0;i<n;i++) {if(i%2==0) {dduo(1+" ");}else {dduo(2+" ");}}dduoln("");}public static void main(String[] args) throws Exception {int t = 1;t = sc.nextInt();while (t-- > 0) {solve();}}static <T> void dduo(T t) {System.out.print(t);}static <T> void dduoln(T t) {System.out.println(t);}}class IOS{BufferedReader bf;StringTokenizer st;BufferedWriter bw;public IOS(){bf=new BufferedReader(new InputStreamReader(System.in));st=new StringTokenizer("");bw=new BufferedWriter(new OutputStreamWriter(System.out));}public String nextLine() throws IOException{return bf.readLine();}public String next() throws IOException{while(!st.hasMoreTokens()){st=new StringTokenizer(bf.readLine());}return st.nextToken();}public char nextChar() throws IOException{return next().charAt(0);}public int nextInt() throws IOException{return Integer.parseInt(next());}public long nextLong() throws IOException{return Long.parseLong(next());}public double nextDouble() throws IOException{return Double.parseDouble(next());}public float nextFloat() throws IOException{return Float.parseFloat(next());}public BigInteger nextBigInteger() throws IOException{return new BigInteger(next());}public BigDecimal nextDecimal() throws IOException{return new BigDecimal(next());}
}

C 题

通过打表发现

1212/12

123123/123

112112/112

都能除尽

所以 我 直接 (str+""+str) /str 求出结果

import java.io.*;
import java.math.*;
import java.util.*;public class Main {static IOS sc=new IOS();static final int MOD = 998244353;public static void solve() throws IOException {String str=sc.next();BigInteger b=new BigInteger(str+str);BigInteger c=new BigInteger(str);dduoln(b.divide(c));}public static void main(String[] args) throws Exception {int t = 1;t = sc.nextInt();while (t-- > 0) {solve();}}static <T> void dduo(T t) {System.out.print(t);}static <T> void dduoln(T t) {System.out.println(t);}}class IOS{BufferedReader bf;StringTokenizer st;BufferedWriter bw;public IOS(){bf=new BufferedReader(new InputStreamReader(System.in));st=new StringTokenizer("");bw=new BufferedWriter(new OutputStreamWriter(System.out));}public String nextLine() throws IOException{return bf.readLine();}public String next() throws IOException{while(!st.hasMoreTokens()){st=new StringTokenizer(bf.readLine());}return st.nextToken();}public char nextChar() throws IOException{return next().charAt(0);}public int nextInt() throws IOException{return Integer.parseInt(next());}public long nextLong() throws IOException{return Long.parseLong(next());}public double nextDouble() throws IOException{return Double.parseDouble(next());}public float nextFloat() throws IOException{return Float.parseFloat(next());}public BigInteger nextBigInteger() throws IOException{return new BigInteger(next());}public BigDecimal nextDecimal() throws IOException{return new BigDecimal(next());}
}

D 题

模拟题

我的解法是先求出位于 (1,1)(2,2)(3,3)(4,4) 点要多少步

不难是 9 ,25, 49, 81...步

我们发现是奇数的平方

所以先求出要求的这个点是从哪个开始的 即(a,a)

然后算到(a,a)一共要多少步

求出还剩多少步

剩下了多少步然后是 在上面走 在右边走 在下面走 在左边走 在上面走 根据 a 可以算出每条边各需要多少步

在每条边上更新剩下要走的步数

即可求出

import java.io.*;
import java.math.*;
import java.util.*;public class Main {static IOS sc=new IOS();static final int MOD = 998244353;public static void solve() throws IOException {long n=sc.nextLong();long ii=0;ii=(long) Math.sqrt(n);ii+=1;if(ii%2==0) {ii++;}ii-=2;
//    	dduoln(ii);
//    	
//    	for(int i=1;i<=1e9;i+=2) {
//    		if(i*i>n) {
//    			ii=i-2;
//    			break;
//    		}
//    	}
//    	dduoln(ii);long a=(ii-1)/2; // 起始位置(a,a)
//    	dduoln(a+" "+a);long ans=(n-ii*ii); // 剩下多少步
//    	dduoln(ans);if(ans==0) {dduoln(a+" "+a);return;}else if(ans==1) {dduoln( (a+1) +" "+a);return;}long duanbian=a*2+1;long changbian=(a+1)*2;ans-=1;// 右if(ans<duanbian) {dduoln((a+1)+" "+(a-ans));return;}ans-=duanbian;// 下if(ans<changbian) {dduoln((a+1-ans)+" "+(-a-1));return;}ans-=changbian;// 左if(ans<changbian) {dduoln((-a-1)+" "+(-a-1+ans));return;}ans-=changbian;dduoln((-a-1+ans)+" "+(a+1));}public static void main(String[] args) throws Exception {int t = 1;t = sc.nextInt();while (t-- > 0) {solve();}}}class IOS{BufferedReader bf;StringTokenizer st;BufferedWriter bw;public IOS(){bf=new BufferedReader(new InputStreamReader(System.in));st=new StringTokenizer("");bw=new BufferedWriter(new OutputStreamWriter(System.out));}public String nextLine() throws IOException{return bf.readLine();}public String next() throws IOException{while(!st.hasMoreTokens()){st=new StringTokenizer(bf.readLine());}return st.nextToken();}public char nextChar() throws IOException{return next().charAt(0);}public int nextInt() throws IOException{return Integer.parseInt(next());}public long nextLong() throws IOException{return Long.parseLong(next());}public double nextDouble() throws IOException{return Double.parseDouble(next());}public float nextFloat() throws IOException{return Float.parseFloat(next());}public BigInteger nextBigInteger() throws IOException{return new BigInteger(next());}public BigDecimal nextDecimal() throws IOException{return new BigDecimal(next());}
}

E 题

动态规划

首先知道了 第一次可以到达 1 6

第二次可以到达 2 12

第三次可以到达 3 18

以此类推

维护一个 dp 数组 代表的是到达当前位置获取到的最大贡献值

再在每次运动 都要 for(1-6) 找一下这六步对 dp 数组的更新

需要注意的是 不要访问到数组外面去

最后找出 dp 数组中的最大值就行

import java.io.*;
import java.math.*;
import java.util.*;public class Main {static IOS sc=new IOS();static final int MOD = 998244353;public static void solve() throws IOException {int n = sc.nextInt();  // n个数int k = sc.nextInt();  // 两次int[] a = new int[n]; // 每个数的数值for (int i = 0; i < n; i++) {a[i] = sc.nextInt();}long[] dp = new long[n + 1];Arrays.fill(dp, Long.MIN_VALUE);dp[0] = 0;for (int step = 1; step <= k; step++) {long[] current = new long[n + 1];Arrays.fill(current, Long.MIN_VALUE);// 求出当前可到达的位置int xmin = step - 1;int xmax = Math.min(6 * (step - 1), n); 
//            dduoln(xmin+" "+xmax);for (int x = xmin; x <= xmax; x++) {for (int d = 1; d <= 6; d++) {int j = x + d;if (j > n) {continue;}current[j]=Math.max(current[j],dp[x] + a[j - 1]);}}dp = current;}int maxfoot = Math.min(6 * k, n); // 最大步数long max = Long.MIN_VALUE;for (int i = k; i <= maxfoot; i++) {max=Math.max(dp[i], max);}dduoln(max);}public static void main(String[] args) throws Exception {int t = 1;
//        t = sc.nextInt();while (t-- > 0) {solve();}}static <T> void dduo(T t) {System.out.print(t);}static <T> void dduoln(T t) {System.out.println(t);}}class IOS{BufferedReader bf;StringTokenizer st;BufferedWriter bw;public IOS(){bf=new BufferedReader(new InputStreamReader(System.in));st=new StringTokenizer("");bw=new BufferedWriter(new OutputStreamWriter(System.out));}public String nextLine() throws IOException{return bf.readLine();}public String next() throws IOException{while(!st.hasMoreTokens()){st=new StringTokenizer(bf.readLine());}return st.nextToken();}public char nextChar() throws IOException{return next().charAt(0);}public int nextInt() throws IOException{return Integer.parseInt(next());}public long nextLong() throws IOException{return Long.parseLong(next());}public double nextDouble() throws IOException{return Double.parseDouble(next());}public float nextFloat() throws IOException{return Float.parseFloat(next());}public BigInteger nextBigInteger() throws IOException{return new BigInteger(next());}public BigDecimal nextDecimal() throws IOException{return new BigDecimal(next());}
}

F 题

BFS

import java.io.*;
import java.math.*;
import java.util.*;public class Main {static IOS sc=new IOS();static final int MOD = 998244353;public static void solve() throws IOException {int startX=0, startY=0, endX=0, endY=0;int n = sc.nextInt();int m = sc.nextInt();int h = sc.nextInt();char[][] grid = new char[n + 1][m + 1];  int[][] minTime = new int[n + 1][m + 1];for (int i = 0; i <= n; i++) {Arrays.fill(minTime[i], Integer.MAX_VALUE);}for (int i = 1; i <= n; i++) {String s = sc.next();for (int j = 1; j <= m; j++) {grid[i][j] = s.charAt(j-1);if (grid[i][j] == '*') { // 记录水源的位置startX = i;startY = j;} else if (grid[i][j] == '%') { // 记录终点的位置endX = i;endY = j;}}}int ans=0;PriorityQueue<int[]> pq = new PriorityQueue<>((a, b) -> a[0] - b[0]);pq.offer(new int[]{0, startX, startY, 1});while (!pq.isEmpty()) {int[] cur = pq.poll();int time = cur[0], x = cur[1], y = cur[2], state = cur[3];if (x == endX && y == endY) { // 到达了终点ans=time;break;}if (state == 0 && minTime[x][y] <= time) continue;minTime[x][y] = Math.min(minTime[x][y], time);if (x + 1 <= n) {if (grid[x + 1][y] == '#') {if (y - 1 >= 1 && grid[x][y - 1] != '#') {pq.offer(new int[]{time + 1, x, y - 1, 0});}if (y + 1 <= m && grid[x][y + 1] != '#') {pq.offer(new int[]{time + 1, x, y + 1, 0});}if (state == 1) {pq.offer(new int[]{time + h + 1, x + 1, y, 1});}}else {pq.offer(new int[]{time + 1, x + 1, y, 1});}}ans=Integer.MAX_VALUE;}dduoln(ans == Integer.MAX_VALUE ? -1 : ans);}public static void main(String[] args) throws Exception {int t = 1;
//        t = sc.nextInt();while (t-- > 0) {solve();}}static <T> void dduo(T t) {System.out.print(t);}static <T> void dduoln(T t) {System.out.println(t);}}class Node implements Comparable<Node> {int x, y, nowT, abi;public Node(int x, int y, int nowT, int abi) {this.x = x;this.y = y;this.nowT = nowT;this.abi = abi;}@Overridepublic int compareTo(Node other) {return Integer.compare(other.nowT, this.nowT); // 按照 nowT 值进行比较,形成最大堆}
}class IOS{BufferedReader bf;StringTokenizer st;BufferedWriter bw;public IOS(){bf=new BufferedReader(new InputStreamReader(System.in));st=new StringTokenizer("");bw=new BufferedWriter(new OutputStreamWriter(System.out));}public String nextLine() throws IOException{return bf.readLine();}public String next() throws IOException{while(!st.hasMoreTokens()){st=new StringTokenizer(bf.readLine());}return st.nextToken();}public char nextChar() throws IOException{return next().charAt(0);}public int nextInt() throws IOException{return Integer.parseInt(next());}public long nextLong() throws IOException{return Long.parseLong(next());}public double nextDouble() throws IOException{return Double.parseDouble(next());}public float nextFloat() throws IOException{return Float.parseFloat(next());}public BigInteger nextBigInteger() throws IOException{return new BigInteger(next());}public BigDecimal nextDecimal() throws IOException{return new BigDecimal(next());}
}

牛客竞赛主页

她说喜欢是装的的比赛主页

http://www.dtcms.com/wzjs/441727.html

相关文章:

  • 网站设计多少钱市场价哪个平台做推广效果好
  • 中国建设监理协会网站查询成绩营销方案100例
  • 网站上传不了图片不显示不出来自己如何制作网站
  • 快件网站建设营销案例100例简短
  • 关于工程项目建设的网站站长统计app最新版本2023
  • 怎样做自己的视频网站每天4元代发广告
  • 给网站做外链要注意哪些黑帽seo技巧
  • 做张网站banner多少钱贵阳搜索引擎排名推广
  • 网站开发加盟商怎么做东莞网站建设最牛
  • 如何取一个大气的名字的做网站seo网站优化培训厂家报价
  • 青州哪里做网站成都私人网站制作
  • 中小企业公共服务平台seo视频教程百度云
  • 廊坊建设企业网站学做网站需要学什么
  • 龙岩网站定制长尾关键词在线查询
  • 成都设计公司电话泰安网站优化公司
  • 长沙制作网站设计多少钱站外推广怎么做
  • 有什么好的网站可以接单子做关键字排名软件官网
  • 北京开发公司网站seo优化怎么做
  • 如何注册自己的工作室独立站seo推广
  • 江西医疗网站建设百度搜索风云榜总榜
  • php和asp做网站哪个好网站seo技术
  • 张家港做网站收费标准百度推广登录平台客服
  • 如何用dw做网站地图磁力天堂最新版地址
  • wordpress 安全性网站优化最为重要的内容是
  • 做网站主页图片一般多少mseo网站排名优化软件
  • 网站可以自己做吗做一个简单的网站需要多少钱
  • 各地民营企业创新前行东莞seo优化团队
  • asp.net做的网站文字控件随窗口大小不变化seo技术培训唐山
  • 关于电器网站建设的法律免费百度下载
  • html5 手机网站开发叫才seo 推广怎么做