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

网站后台怎么修改前台的某个超链接网址广州网络运营课程培训班

网站后台怎么修改前台的某个超链接网址,广州网络运营课程培训班,asp.net网站开发视频教程,福州做网站互联网公司有哪些目录 A 报数游戏 B 类斐波那契循环数 C 分布式队列 D 食堂 E 最优分组 F 星际旅行 G LITS 游戏 H 拼十字 今天心血来潮把去年的题目又做了一遍... 本人去年大一 拿的是全省第五进的国赛 而如今的已经是一名 codeforces 1500 分的入门级别的算竞选手了 下周又是蓝桥杯…

目录

A 报数游戏

B 类斐波那契循环数

C 分布式队列

D 食堂

E 最优分组

F 星际旅行

G LITS 游戏

H 拼十字


今天心血来潮把去年的题目又做了一遍...

本人去年大一 拿的是全省第五进的国赛

而如今的已经是一名 codeforces 1500 分的入门级别的算竞选手了

下周又是蓝桥杯了 想起来后又做了一遍

仅代表个人做题记录

A 报数游戏

import java.util.Scanner;
// 1:无需package
// 2: 类名必须Main, 不可修改public class Main {public static void main(String[] args) {Scanner scan = new Scanner(System.in);System.out.println("2429042904288");//在此输入您的代码...scan.close();}
}

B 类斐波那契循环数

import java.util.Scanner;
// 1:无需package
// 2: 类名必须Main, 不可修改public class Main {public static void main(String[] args) {Scanner scan = new Scanner(System.in);System.out.println("7913837");//在此输入您的代码...scan.close();}
}

C 分布式队列

模拟题

import java.io.*;
import java.math.*;
import java.util.*;public class Main {static Scanner sc = new Scanner(System.in);static final long MOD = (long) (1e9+7);public static void solve() throws IOException {int n=sc.nextInt();// 主节点的数字int ans1=0;// 其余结点int arr[]=new int[n-1];while(sc.hasNext()) {String str=sc.next();if(str.equals("add")) {// 添加int k = sc.nextInt();ans1++;}else if(str.equals("sync")){// 同步int k = sc.nextInt()-1;if(arr[k]<ans1) {arr[k]++;}}else if(str.equals("query")) {// 查询int ans=Integer.MAX_VALUE;for(int j=0;j<n-1;j++) {ans=Math.min(ans, arr[j]);}System.out.println(ans);}}}public static void main(String[] args) throws Exception {int t = 1;
//        t = sc.nextInt();while (t-- > 0) {solve();}}}

D 食堂

数据范围很小啊

把每一种情况都列举出来了

// @github https://github.com/Dddddduo
// @github https://github.com/Dddddduo/acm-java-algorithm
// @github https://github.com/Dddddduo/Dduo-mini-data_structure
import java.util.*;
import java.io.*;
import java.math.*;
import java.lang.*;
import java.time.*;// 食堂// xixi♡西
public class Main {static Scanner sc = new Scanner(System.in);static final int mod = (int) (1e9 + 7);/*** @throws IOException*/private static void solve() throws IOException {// todoint a2=sc.nextInt();int a3=sc.nextInt();int a4=sc.nextInt();int b4=sc.nextInt();int b6=sc.nextInt();int ans = 0;while (b6 > 0) { // 3+3if (a3 >= 2) {b6--;a3 -= 2;ans += 6;} else {break;}}while (b6 > 0) { // 4+2if (a4 > 0 && a2 > 0) {b6--;a4--;a2--;ans += 6;} else {break;}}while (b6 > 0) { // 2+2+2if (a2 >= 3) {b6--;a2 -= 3;ans += 6;} else {break;}}while (b6 > 0) { // 3+2if (a3 > 0 && a2 > 0) {b6--;a3--;a2--;ans += 5;} else {break;}}while (b6 > 0) { // 4if (a4 > 0) {b6--;a4--;ans += 4;} else {break;}}if (b6 > 0 && a2 == 2) { // 2+2ans += 4;b6--;a2 = 0;}if (b6 > 0 && a3 > 0) { // 3ans += 3;b6--;a3 = 0;}if (b6 > 0 && a2 > 0) { // 2ans += 2;a2 = 0;}while (b4 > 0) { // 4if (a4 > 0) {b4--;a4--;ans += 4;} else {break;}}while (b4 > 0) { // 2+2if (a2 >= 2) {b4--;a2 -= 2;ans += 4;} else {break;}}while (b4 > 0) { // 3if (a3 > 0) {b4--;a3--;ans += 3;} else {break;}}if (b4 > 0 && a2 > 0) { // 2ans += 2;}System.out.println(ans);}public static void main(String[] args) throws Exception {int t = 1;t = sc.nextInt();while (t-- > 0) {solve();}}}

E 最优分组

注意用小数进行运算即可

import java.io.*;
import java.math.*;
import java.util.*;public class Main {static Scanner sc = new Scanner(System.in);static final long MOD = (long) (1e9+7);public static void solve() throws IOException {long n=sc.nextLong(); // N只宠物double p=1.0-sc.nextDouble(); // 没被感染的概率if(p==1){System.out.println("0");return;}if(p==0){System.out.println(n);return;}if(n==1){System.out.println("1");return;}double num=n+1; // 消耗的数目long k=0;for(int i=1;i<=n;i++) { // i个人一组 每组恰好有i只宠物double ans = 0; // 消耗的试剂double ans1 = 0; // 分成多少组if(n%i==0) {ans1=n/i*1.0;}else {continue;}// 先统一测试ans+=ans1;// 恰好分成ans1组 每组i个人// 全部是阴性的概率double quanbuyingxing=1.0;for (int i1 = 0; i1 < i; i1++) {quanbuyingxing*=p;}// 有阳性的概率double youyang=1.0-quanbuyingxing;// 有多少组阳性的double yangzu=youyang*ans1*1.0;// 分别测ans+=yangzu*i;if(ans<num){num=ans;k=i;}}System.out.println(k);}public static void main(String[] args) throws Exception {int t = 1;
//        t = sc.nextInt();while (t-- > 0) {solve();}}}

F 星际旅行

我自己搓的版本 bfs

import java.util.*;
// 1:无需package
// 2: 类名必须Main, 不可修改public class Main {static ArrayList<ArrayList<Integer>>adj;public static void main(String[] args) {Scanner sc = new Scanner(System.in);// 邻接矩阵adj=new ArrayList<>();int n=sc.nextInt(); // n个星球int m=sc.nextInt(); // m道传送门int q=sc.nextInt(); // 盲盒long sum=0;for (int i = 0; i < n+5; i++) {adj.add(new ArrayList<>());}for (int i = 0; i < m; i++) {int u=sc.nextInt();int v=sc.nextInt();// 双向图adj.get(u).add(v);adj.get(v).add(u);}int arr[][]=new int[q][2];HashMap<Integer, Integer> hm = new HashMap<>();for (int i = 0; i < q; i++) {int u=sc.nextInt(); // 当前节点int cnt=sc.nextInt();  // 旅行卷轴 多少层arr[i][0]=u;arr[i][1]=cnt;if(hm.containsKey(u)==false){hm.put(u,cnt);}else {int value= hm.get(u);hm.put(u,Math.max(value,cnt));}}ArrayList<ArrayList<Integer>>yuchuli=new ArrayList<>();for (int i = 0; i < n+5; i++) {yuchuli.add(new ArrayList<>());}for (Integer i : hm.keySet()) {int u=i; // 当前节点int max=hm.get(u); // 最大旅行卷轴
//            System.out.println(u+" "+max);int ans=1; // 当前层有1个Queue<Integer>queue=new LinkedList<>();queue.add(u);int jishu=0; // 计数int sumsum=0;
//            System.out.println(sumsum);while (!queue.isEmpty()){Integer poll = queue.poll();
//                System.out.println(u+" "+poll);jishu++; // 计数for(int in:adj.get(poll)){if(in!=u){queue.add(in);}}if(jishu==ans){ans=queue.size();
//                    System.out.println("当前层有"+ans);sumsum+=jishu;
//                    System.out.println(u+" "+sumsum);yuchuli.get(u).add(sumsum);jishu=0;max--;if(max<0){break;}}}}for (int i = 0; i < q; i++) {Integer i1 = yuchuli.get(arr[i][0]).get(arr[i][1]);
//            System.out.println(i1);sum+=i1;}System.out.println(String.format("%.2f",(double)sum/(double) n/1.0));}
}

这是看了题解的版本 Floyd算法

import java.util.Scanner;public class Main {static int[][] d = new int[1010][1010];public static void main(String[] args) {Scanner sc = new Scanner(System.in);long n, m, Q;n = sc.nextInt();m = sc.nextInt();Q = sc.nextInt();for (int i = 1; i <= n; i++){for (int j = 1; j <= n; j++){if (i == j){d[i][j] = 0;}else {d[i][j] = (int) 1e9;}}}for (int i = 0; i < m; i++) {int a, b;a = sc.nextInt();b = sc.nextInt();d[a][b] = d[b][a] = 1;}// Floyd算法for (int k = 1; k <= n; k++)for (int i = 1; i <= n; i++)for (int j = 1; j <= n; j++)d[i][j] = Math.min(d[i][j], d[i][k] + d[k][j]);double ans = 0;for (int i = 0; i < Q; i++) {int x, y;x = sc.nextInt();y = sc.nextInt();for (int j = 1; j <= n; j++){if (d[x][j] <= y) {ans = ans + 1;}}}System.out.printf("%.2f", ans / Q);}
}

G LITS 游戏

不会

import java.io.*;
import java.math.*;
import java.util.*;// LITS 游戏public class Main {static Scanner sc = new Scanner(System.in);static final long MOD = (long) (1e9+7);public static void solve() throws IOException {System.out.println("NO");}public static void main(String[] args) throws Exception {int t = 1;t = sc.nextInt();while (t-- > 0) {solve();}}}

H 拼十字

直接暴力的

import java.io.*;
import java.math.*;
import java.util.*;public class Main {static Scanner sc = new Scanner(System.in);static final long MOD = (long) (1e9+7);static class Pair{// 长long l;// 宽long w;// 带参构造Pair(long ll,long ww){this.l=ll;this.w=ww;}}public static void solve() throws IOException {int n=sc.nextInt();ArrayList<Pair>list0=new ArrayList<>();ArrayList<Pair>list1=new ArrayList<>();ArrayList<Pair>list2=new ArrayList<>();for(int i=0;i<n;i++) {long l=sc.nextLong(); // 长long w=sc.nextLong(); // 宽long c=sc.nextLong(); // 颜色if(c==0) {list0.add(new Pair(l,w));}else if(c==1){list1.add(new Pair(l,w));}else {list2.add(new Pair(l,w));}}long cnt=0;// 颜色0 和 颜色 1for(int i=0;i<list0.size();i++) {for(int j=0;j<list1.size();j++) {long chang1 = list0.get(i).l;long kuan1  = list0.get(i).w;long chang2 = list1.get(j).l;long kuan2  = list1.get(j).w;if( (chang1>chang2&&kuan1<kuan2) || (chang1<chang2&&kuan1>kuan2)) {cnt++;}}}// 颜色1 和 颜色2for(int i=0;i<list1.size();i++) {for(int j=0;j<list2.size();j++) {long chang1 = list1.get(i).l;long kuan1  = list1.get(i).w;long chang2 = list2.get(j).l;long kuan2  = list2.get(j).w;if( (chang1>chang2&&kuan1<kuan2) || (chang1<chang2&&kuan1>kuan2)) {cnt++;}}}// 颜色0 和 颜色2for(int i=0;i<list0.size();i++) {for(int j=0;j<list2.size();j++) {long chang1 = list0.get(i).l;long kuan1  = list0.get(i).w;long chang2 = list2.get(j).l;long kuan2  = list2.get(j).w;if( (chang1>chang2&&kuan1<kuan2) || (chang1<chang2&&kuan1>kuan2)) {cnt++;}}}System.out.print(cnt);}public static void main(String[] args) throws Exception {int t = 1;
//        t = sc.nextInt();while (t-- > 0) {solve();}}}
http://www.dtcms.com/wzjs/40683.html

相关文章:

  • 房地产网站设计公司做网站建设的公司
  • 描写做网站专业的句子潍坊网站建设优化
  • 平板电脑可以做网站不seo专员岗位职责
  • 宁波网站建设托管企业网站搭建
  • 如何查询网站后台地址宁德市古田县
  • 免费网站赚钱建站快车
  • asp网站配置伪静态网站友情链接的作用
  • 阿里云 网站根目录全球十大网站排名
  • 企业网站源代码下载福州短视频seo推荐
  • 网站修改图片怎么做广州网站优化推广
  • 信息技术八年级上册网站建设模板建站优点
  • 怎么进行网站备案北京seo外包 靠谱
  • 网站设计用什么软件实现深圳今天重大事件新闻
  • 合肥知名网站制作域名地址查询
  • 经典网站设计风格品牌推广宣传词
  • 网站开发包括软件吗重庆关键词seo排名
  • 做淘宝客建网站要多少费用比较好的网络推广平台
  • 有哪些网站可以做推文宁波seo推广咨询
  • 沧州高端网站建设138ip查询网域名解析
  • 秦皇岛电子网站建设谷歌浏览器 安卓下载
  • 投资公司怎么赚钱长沙seo男团
  • 哪里做网站域名不用备案山东网络优化公司排名
  • 网站建设的会计核算推广关键词外包
  • asp全静态企业网站上海做关键词推广企业
  • 在线网页代理服务器seo优化或网站编辑
  • 扁平设计网站北京seo关键词排名
  • 网站中微信公众号链接怎么做网站制作公司哪家好
  • 优质的企业网站建设百度竞价推广是什么
  • 做微网站的公司哪家好呢找关键词的三种方法
  • 网站建设公司人员配备seo研究中心学员案例