排行榜

  • 用户榜
  • 冲榜分奖金

频道

最新最热悬赏待采纳 筛选
  • 0

    回答

  • 1

    浏览

  使用R语言  数据包“rvest” 去爬取世界2011至2021年间的世界100强企业。 指定网站:(https://brandirectory.com/rankings/global/table). 这里爬出来的是2021年的世界500强, 请问要怎么改才能提取到前100强以及有没有更加有效率的方法爬取2011-2021年的十年间的方法呢? 还是就只能一年一年的爬取了。    url <-'https://brandirectory.com/rankings/global/2021/table' webpage <- read_html(url) xdata <- webpage %>% html_nodes("tbody tr") DataX = NULL for (i in 1:length(xdata)){ tmp <- xdata[i] %>% html_nodes("td") rank21 <- tmp[1] %>% html_text() %>% as.numeric() rank20 <- tmp[2] %>% html_text() %>% as.numeric() company = trimws(gsub("\n", "", tmp[3] %>% html_text())) country = trimws(gsub("\n", "", tmp[4] %>% html_text())) flag <- tmp[5] %>% html_nodes("img") %>% xml_attr("src") value21 <- tmp[5] %>% html_nodes("span") %>% html_text() value20 <- tmp[6] %>% html_nodes("span") %>% html_text() rate21 = trimws(gsub("\n", "", tmp[7] %>% html_text())) rate20 = trimws(gsub("\n", "", tmp[8] %>% html_text())) DataX = rbind(DataX, c(rank21, rank20,company, country, value21, value20, rate21, rate20)) }

  • 0

    回答

  • 1

    浏览

请教下,我在启动后yapi报以下错误,在百度上查到说要找到进程然后杀死,但是为什么我每杀一个就冒出来了一个新的进程,这个错误应该如何解决?  

回答 CFDN_CN
采纳率26.7%
2小时前
  • 1

    回答

  • 12

    浏览

在跟着一个实战美团的前端练习,跟着他更新了rem.js和reset.js之后为什么我的页面还是没有变化呢 mian.js中的代码如下: import '@/assets/css/reset.css' import '@/assets/js/rem.js' 但是ui界面并没有变成手机大小,请问这是为什么

回答 -cfyjbjonn
采纳率75.9%
3小时前
  • 1

    回答

  • 3

    浏览

提问: 以下为自己见解,不知道正不正确,大佬们纠正一下。 int *a = 10; 其实就是a的地址里面存放了常量10 *a就是解引用,通过a地址访问得到常量10 &a就是取a这个变量的地址 那么a是一个指针变量?

  • 1

    回答

  • 2

    浏览

第六题怎么敲?[face]monkey2:009.png[/face][face]monkey2:002.png[/face]

  • 0

    回答

  • 2

    浏览

from matplotlib import pyplot as plt %matplotlib inline    报错如下: --------------------------------------------------------------------------- KeyError Traceback (most recent call last) <ipython-input-79-b5c1b06a2025> in <module> ----> 1 from matplotlib import pyplot as plt 2 get_ipython().run_line_magic('matplotlib', 'inline') ~\Anaconda3\lib\site-packages\matplotlib\pyplot.py in <module> 34 from cycler import cycler 35 import matplotlib ---> 36 import matplotlib.colorbar 37 import matplotlib.image 38 from matplotlib import _api ~\Anaconda3\lib\site-packages\matplotlib\colorbar.py in <module> 40 import matplotlib.patches as mpatches 41 import matplotlib.path as mpath ---> 42 import matplotlib.spines as mspines 43 import matplotlib.transforms as mtransforms 44 from matplotlib import docstring ~\Anaconda3\lib\site-packages\matplotlib\spines.py in <module> 12 13 ---> 14 class Spine(mpatches.Patch): 15 """ 16 An axis spine -- the line noting the data area boundaries. ~\Anaconda3\lib\site-packages\matplotlib\spines.py in Spine() 32 return "Spine" 33 ---> 34 @docstring.dedent_interpd 35 def __init__(self, axes, spine_type, path, **kwargs): 36 """ ~\Anaconda3\lib\site-packages\matplotlib\docstring.py in dedent_interpd(func) ~\Anaconda3\lib\site-packages\matplotlib\docstring.py in __call__(self, func) 38 def __call__(self, func): 39 if func.__doc__: ---> 40 func.__doc__ = inspect.cleandoc(func.__doc__) % self.params 41 return func 42 KeyError: 'Patch_kwdoc 不知道这个kwdoc补丁报错是怎么回事,已经重新卸载并安装matplotlib 包多次都不好使,并且matplotlib版本为3.4.1

  • 0

    回答

  • 1

    浏览

<?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <groupId>org.example</groupId> <artifactId>springMVC_02</artifactId> <version>1.0-SNAPSHOT</version> <packaging>war</packaging> <properties> <maven.compiler.source>8</maven.compiler.source> <maven.compiler.target>8</maven.compiler.target> <spring.version>5.0.2.RELEASE</spring.version> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> </properties> <dependencies> <dependency> <groupId>org.springframework</groupId> <artifactId>spring-webmvc</artifactId> <version>${spring.version}</version> </dependency> <dependency> <groupId>javax.servlet</groupId> <artifactId>servlet-api</artifactId> <version>2.5</version> <scope>provided</scope> </dependency> <!-- <dependency> <groupId>javax.servlet</groupId> <artifactId>javax.servlet-api</artifactId> <version>3.1.0</version> <scope>provided</scope> </dependency>--> <dependency> <groupId>javax.servlet.jsp</groupId> <artifactId>jsp-api</artifactId> <version>2.0</version> <scope>provided</scope> </dependency> <dependency> <groupId>org.projectlombok</groupId> <artifactId>lombok</artifactId> <version>1.18.12</version> </dependency> <!--jackson的依赖--> <dependency> <groupId>com.fasterxml.jackson.core</groupId> <artifactId>jackson-databind</artifactId> <version>2.9.0</version> </dependency> <dependency> <groupId>com.fasterxml.jackson.core</groupId> <artifactId>jackson-core</artifactId> <version>2.9.0</version> </dependency> <dependency> <groupId>com.fasterxml.jackson.core</groupId> <artifactId>jackson-annotations</artifactId> <version>2.9.0</version> </dependency> <!-- <dependency> <groupId>javax</groupId> <artifactId>javaee-api</artifactId> <version>7.0</version> <scope>provided</scope> </dependency>--> </dependencies> <build> <plugins> <!-- maven的jdk编译插件 --> <!-- <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-compiler-plugin</artifactId> <version>3.3</version> <configuration> <source>1.7</source> <target>1.7</target> <encoding>UTF-8</encoding> <showWarnings>true</showWarnings> </configuration> </plugin>--> <plugin> <groupId>org.apache.tomcat.maven</groupId> <artifactId>tomcat7-maven-plugin</artifactId> <version>2.2</version> <configuration> <!--端口号--> <port>8080</port> <!--path就相当于部署项目时候的ContextPath--> <path>/</path> </configuration> </plugin> </plugins> </build> </project> 以上是pom.xml,用maven插件启动项目时报错,折腾了好久都没解决,哪位大佬帮忙一下,谢谢! 报错信息: "D:\Program Files\Java\jdk1.8.0_91\bin\java.exe" -Dmaven.multiModuleProjectDirectory=C:\Users\Administrator\IdeaProjects\springMVC\springMVC_02 -DarchetypeCatalog=internal "-Dmaven.home=D:\Program Files\apache-maven-3.6.3" "-Dclassworlds.conf=D:\Program Files\apache-maven-3.6.3\bin\m2.conf" "-Dmaven.ext.class.path=D:\Program Files\JetBrains\IntelliJ IDEA 2020.3.2\plugins\maven\lib\maven-event-listener.jar" "-javaagent:D:\Program Files\JetBrains\IntelliJ IDEA 2020.3.2\lib\idea_rt.jar=54164:D:\Program Files\JetBrains\IntelliJ IDEA 2020.3.2\bin" -Dfile.encoding=UTF-8 -classpath "D:\Program Files\apache-maven-3.6.3\boot\plexus-classworlds-2.6.0.jar;D:\Program Files\apache-maven-3.6.3\boot\plexus-classworlds.license" org.codehaus.classworlds.Launcher -Didea.version=2020.3.2 -s "D:\Program Files\apache-maven-3.6.3\conf\settings.xml" "-Dmaven.repo.local=D:\Program Files\apache-maven-3.6.3\repository" tomcat7:run [INFO] Scanning for projects... [INFO]  [INFO] ----------------------< org.example:springMVC_02 >---------------------- [INFO] Building springMVC_02 1.0-SNAPSHOT [INFO] --------------------------------[ war ]--------------------------------- [INFO]  [INFO] >>> tomcat7-maven-plugin:2.2:run (default-cli) > process-classes @ springMVC_02 >>> [INFO]  [INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ springMVC_02 --- [INFO] Using 'UTF-8' encoding to copy filtered resources. [INFO] Copying 1 resource [INFO]  [INFO] --- maven-compiler-plugin:3.1:compile (default-compile) @ springMVC_02 --- [INFO] Nothing to compile - all classes are up to date [INFO]  [INFO] <<< tomcat7-maven-plugin:2.2:run (default-cli) < process-classes @ springMVC_02 <<< [INFO]  [INFO]  [INFO] --- tomcat7-maven-plugin:2.2:run (default-cli) @ springMVC_02 --- [INFO] Running war on http://localhost:8080/ [INFO] Using existing Tomcat server configuration at C:\Users\Administrator\IdeaProjects\springMVC\springMVC_02\target\tomcat [INFO] create webapp with contextPath:  四月 14, 2021 12:56:02 上午 org.apache.coyote.AbstractProtocol init 信息: Initializing ProtocolHandler ["http-bio-8080"] 四月 14, 2021 12:56:02 上午 org.apache.catalina.core.StandardService startInternal 信息: Starting service Tomcat 四月 14, 2021 12:56:02 上午 org.apache.catalina.core.StandardEngine startInternal 信息: Starting Servlet Engine: Apache Tomcat/7.0.47 四月 14, 2021 12:56:03 上午 org.apache.catalina.core.ContainerBase startInternal 严重: A child container failed during start java.util.concurrent.ExecutionException: org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Tomcat].StandardHost[localhost].StandardContext[]]     at java.util.concurrent.FutureTask.report(FutureTask.java:122)     at java.util.concurrent.FutureTask.get(FutureTask.java:192)     at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:1123)     at org.apache.catalina.core.StandardHost.startInternal(StandardHost.java:800)     at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)     at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1559)     at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1549)     at java.util.concurrent.FutureTask.run(FutureTask.java:266)     at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)     at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)     at java.lang.Thread.run(Thread.java:745) Caused by: org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Tomcat].StandardHost[localhost].StandardContext[]]     at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:154)     ... 6 more Caused by: java.lang.ClassCastException: org.springframework.web.SpringServletContainerInitializer cannot be cast to javax.servlet.ServletContainerInitializer     at org.apache.catalina.startup.ContextConfig.getServletContainerInitializer(ContextConfig.java:1670)     at org.apache.catalina.startup.ContextConfig.getServletContainerInitializers(ContextConfig.java:1652)     at org.apache.catalina.startup.ContextConfig.processServletContainerInitializers(ContextConfig.java:1562)     at org.apache.catalina.startup.ContextConfig.webConfig(ContextConfig.java:1270)     at org.apache.catalina.startup.ContextConfig.configureStart(ContextConfig.java:878)     at org.apache.catalina.startup.ContextConfig.lifecycleEvent(ContextConfig.java:376)     at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:119)     at org.apache.catalina.util.LifecycleBase.fireLifecycleEvent(LifecycleBase.java:90)     at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5322)     at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)     ... 6 more 四月 14, 2021 12:56:03 上午 org.apache.catalina.core.ContainerBase startInternal 严重: A child container failed during start java.util.concurrent.ExecutionException: org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Tomcat].StandardHost[localhost]]     at java.util.concurrent.FutureTask.report(FutureTask.java:122)     at java.util.concurrent.FutureTask.get(FutureTask.java:192)     at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:1123)     at org.apache.catalina.core.StandardEngine.startInternal(StandardEngine.java:302)     at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)     at org.apache.catalina.core.StandardService.startInternal(StandardService.java:443)     at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)     at org.apache.catalina.core.StandardServer.startInternal(StandardServer.java:732)     at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)     at org.apache.catalina.startup.Tomcat.start(Tomcat.java:341)     at org.apache.tomcat.maven.plugin.tomcat7.run.AbstractRunMojo.startContainer(AbstractRunMojo.java:1238)     at org.apache.tomcat.maven.plugin.tomcat7.run.AbstractRunMojo.execute(AbstractRunMojo.java:592)     at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:137)     at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:210)     at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:156)     at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:148)     at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:117)     at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:81)     at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder.java:56)     at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:128)     at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:305)     at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:192)     at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:105)     at org.apache.maven.cli.MavenCli.execute(MavenCli.java:957)     at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:289)     at org.apache.maven.cli.MavenCli.main(MavenCli.java:193)     at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)     at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)     at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)     at java.lang.reflect.Method.invoke(Method.java:498)     at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:282)     at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:225)     at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:406)     at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:347)     at org.codehaus.classworlds.Launcher.main(Launcher.java:47) Caused by: org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Tomcat].StandardHost[localhost]]     at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:154)     at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1559)     at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1549)     at java.util.concurrent.FutureTask.run(FutureTask.java:266)     at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)     at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)     at java.lang.Thread.run(Thread.java:745) Caused by: org.apache.catalina.LifecycleException: A child container failed during start     at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:1131)     at org.apache.catalina.core.StandardHost.startInternal(StandardHost.java:800)     at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)     ... 6 more [INFO] ------------------------------------------------------------------------ [INFO] BUILD FAILURE [INFO] ------------------------------------------------------------------------ [INFO] Total time:  5.174 s [INFO] Finished at: 2021-04-14T00:56:03+08:00 [INFO] ------------------------------------------------------------------------ [ERROR] Failed to execute goal org.apache.tomcat.maven:tomcat7-maven-plugin:2.2:run (default-cli) on project springMVC_02: Could not start Tomcat: Failed to start component [StandardServer[-1]]: Failed to start component [StandardService[Tomcat]]: Failed to start component [StandardEngine[Tomcat]]: A child container failed during start -> [Help 1] [ERROR]  [ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch. [ERROR] Re-run Maven using the -X switch to enable full debug logging. [ERROR]  [ERROR] For more information about the errors and possible solutions, please read the following articles: [ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException Process finished with exit code 1  

  • 0

    回答

  • 1

    浏览

superset 3.7  中, Sources项下, Edit Database中 SQLAlchemy URI *输入地址后显示 seems ok!但是,在SQL Lab项中,SQL editor无法获取schema、tables数据,并且报错显示Error while fetching schema list。 Sources项下, Tables中,输入数据库中相应schema和data名称,也是无法提取相应数据并提示如下文字。 在superset中再次安装pip install mysqlclient并重新加载数据后,依旧报错无法获取数据。 在superset的Permissions中增加databass acess、schema acess相关权限后,依旧报错无法获取数据。 命令提示符中显示: 懵了已经,请大神指导,万分感谢。

  • 1

    回答

  • 3

    浏览

alert(countOfWorld("world,8thanks*0you>like0000)))what")) function countOfWorld(str){ var count = 0; for(i = 0; i < str.length - 1; i++){ if(isABC(str[i]) && !isABC(str[i + 1])){ count++; } } return count; } function isABC(scc){ if(scc >= "a" && scc <= "z" || scc >= "A" & scc <= "Z"){ return true; }else return false; } 这串代码的逻辑是第一个字母是单词,第二个字母不是单词,但是最后一个单词后面没有非字母了,所以无法判断,所以怎样优化代码可以把最后一个单词也数进去?

回答 m0_46602893
采纳率48.6%
4小时前
  • 0

    回答

  • 2

    浏览

删了multism想重装,就下载了个NI卸载工具卸载干净,刚下好有用,但是还是安装不成功,但是有多了个东西,就想再进行卸载,点开却总是显示“发现National lnstruments共享组件,与任何产品均无关联。是否删除这些共享组件?”,救救孩子!!

  • 1

    回答

  • 4

    浏览

刚创建项目时,运行没问题 之后加入请求http://localhost:8080/exam?userNo=1280#/ 就一直报错 网上提供的方法,注释node_module 下的xhr无用,重启项目也无用

  • 0

    回答

  • 8

    浏览

今天面试美团,好久没面试了,现在都问这些算法,给我整懵了,说实话我都没看懂!求大佬指点一下! 如下题: 返回与给定的前序和后序遍历匹配的任何二叉树。  pre 和 post 遍历中的值是不同的正整数。 示例: 输入:pre = [1,2,4,5,3,6,7], post = [4,5,2,6,7,3,1] 输出:[1,2,3,4,5,6,7]   提示: 1 <= pre.length == post.length <= 30 pre[] 和 post[] 都是 1, 2, ..., pre.length 的排列 每个输入保证至少有一个答案。如果有多个答案,可以返回其中一个。

回答 He_mengcheng
采纳率66.7%
4小时前
  • 1

    回答

  • 8

    浏览

function symmetryArr(arr){ var arr2 = arr.reverse(); return(arr); } var scc = ["one", "two", "three"]; // var css = scc.reverse() alert(scc + symmetryArr(scc)) 为什么执行的结果不是"one", "two", "three”“three” “two” “one”?

回答 m0_46602893
采纳率48.6%
4小时前
  • 1

    回答

  • 3

    浏览

在使用angualr的自定义校验的时候 get phone(){return this.formGroup.get('name')}  会报错:'get' does not exist on type '{}'  import { Component, OnInit } from '@angular/core'; import { FormControl, FormGroup, Validators } from '@angular/forms'; import { forbiddenNameValidaotr } from '../forbiddenName'; @Component({ selector: 'app-self-order-form', templateUrl: './self-order-form.component.html', styleUrls: ['./self-order-form.component.css'], }) export class SelfOrderFormComponent implements OnInit { user = { name: '' }; myGroup = {}; constructor() {} ngOnInit(): void { this.myGroup = new FormGroup({ name: new FormControl(this.user.name, [ Validators.required, forbiddenNameValidaotr(/^tim/), ]), }); } get name() { return this.myGroup.get('name'); } onSubmit() {} }  

  • 1

    回答

  • 7

    浏览

var Str="hello world"; var result=Str.filter('e'); console.log(result); String.prototype.filter=function(){ if(arguments.length<1) throw new Error('缺少参数'); var a = [], _this = this; for( var i =0; i < arguments.length; i++){ a.push(arguments[i]); } var i = -1; a.forEach(function(key,m,n){ if(i != -1) return true; //这应该是个排错语句 i = _this.indexOf(key) //检索字符串在字符串中首次出现的位置,第二个参数表示开始检索的位置。方法.若没有检索到。则返回-1. console.log(m); console.log(n); }); if(i == -1){ return false; } else{ return i; } } /* var Str="hello world"; var result=Str.filter('e'); console.log(result); */ node js 方式运行报错 SyntaxError: Unexpected end of input     at wrapSafe (internal/modules/cjs/loader.js:979:16)     at Module._compile (internal/modules/cjs/loader.js:1027:27)     at Object.Module._extensions..js (internal/modules/cjs/loader.js:1092:10)     at Module.load (internal/modules/cjs/loader.js:928:32)     at Function.Module._load (internal/modules/cjs/loader.js:769:14)     at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:72:12)     at internal/main/run_main_module.js:17:47 自己看了好久没看出来问题在哪里,请教大佬们

回答 TomKing9
采纳率100%
5小时前
  • 0

    回答

  • 7

    浏览

  • 0

    回答

  • 4

    浏览

Park Visit  HDU - 4607 这两个用vector就ac了 e[N]TLE了  所以我想知道这两种在点数和边数在什么情况下时间或空间最有力 .?谢谢 #include<stdio.h> #include<cstring> #include<iostream> #include<vector> using namespace std; const int N=1e5+10; vector<int>G[N]; int e[N],h[N],ne[N],idx; int dis[N]; void add(int a,int b) { e[idx]=b,ne[idx]=h[a],h[a]=idx++; } void dfs(int u) { for(int i=0;i<G[u].size();i++) { int j=G[u][i]; if(!dis[j]) { dis[j]=dis[u]+1; dfs(j); } } } int main() { int t; scanf("%d",&t); while(t--) { //memset(h,-1,sizeof h);idx=0; int n,m; scanf("%d%d",&n,&m); for(int i=1;i<=n;i++)G[i].clear(); for(int i=0;i<n-1;i++) { int u,v; scanf("%d%d",&u,&v); G[u].push_back(v); G[v].push_back(u); } memset(dis,0,sizeof dis); dis[1]=1;dfs(1); int st=1; for(int i=2;i<=n;i++) if(dis[i]>dis[st])st=i; memset(dis,0,sizeof dis); dis[st]=1;dfs(st); int end=1; for(int i=2;i<=n;i++) if(dis[i]>dis[end])end=i; int ma=dis[end]; for(int i=0;i<m;i++) { int k; scanf("%d",&k); if(ma<k) printf("%d\n",ma-1-(ma-k)*2); else printf("%d\n",k-1); } } } #include<stdio.h> #include<cstring> #include<iostream> using namespace std; const int N=1e5+10; int e[N],h[N],ne[N],idx; int dis[N]; void add(int a,int b) { e[idx]=b,ne[idx]=h[a],h[a]=idx++; } void dfs(int u) { for(int i=h[u];i!=-1;i=ne[i]) { int j=e[i]; if(!dis[j]) { dis[j]=dis[u]+1; dfs(j); } } } int main() { int t; scanf("%d",&t); while(t--) { memset(h,-1,sizeof h);idx=0; int n,m; scanf("%d%d",&n,&m); for(int i=0;i<n-1;i++) { int u,v; scanf("%d%d",&u,&v); add(u,v); add(v,u); } memset(dis,0,sizeof dis); dis[1]=1;dfs(1); int st=1; for(int i=2;i<=n;i++) if(dis[i]>dis[st])st=i; memset(dis,0,sizeof dis); dis[st]=1;dfs(st); int end=1; for(int i=2;i<=n;i++) if(dis[i]>dis[end])end=i; int ma=dis[end]; for(int i=0;i<m;i++) { int k; scanf("%d",&k); if(ma<k) printf("%d\n",ma-1-(ma-k)*2); else printf("%d\n",k-1); } } }  

  • 2

    回答

  • 10

    浏览

如果你的领导是这样的: 业务能力不行,产品要求抄袭他上家公司产品,原封不动,最后bug也一起抄过来了。对于产品的规划能力那是PPT也给不出来,就是对标抄袭他上家公司的产品。 专业能力不行,还要事事干预,觉得其他人不行,最后出事了,甩锅那是一个漂亮。 沟通能力不行,和你沟通,可以把包括你在内的周围一圈人都给得罪光。 但是老板很信任他,几乎成了老板之外的全民公敌。 遇到这样的领导,该怎么相处?

  • 3

    回答

  • 9

    浏览

import java.util.Scanner; public class FlightTickets{ public static void main(String[] args){ Scanner sc = new Scanner(System.in); {System.out.println("please input the date and individed the month and the day by','");} String date_1 =sc.nextLine(); String [] date = date_1.split(","); int[] time = new int[2]; for(int i=0;i<date.length;i++) { time[i]=Integer.parseInt(date[i]); //著名输入算法 } Scanner scan = new Scanner(System.in); {System.out.println("please input the amount of your tickets");} int amount = scan.nextInt(); int price=0; switch(time[1]){ case 1: if(time[2]==1||time[2]==28) price=1200; else if(time[2]==7||time[2]==8||time[2]==14||time[2]==15||time[2]==21||time[2]==22||time[2]==29) price=1200*8/10; else price=1200*6/10; break; case 2: if(time[2]==11) price=1200; else if(time[2]==4||time[2]==5||time[2]==12||time[2]==18||time[2]==19||time[2]==25||time[2]==26) price=1200*8/10; else price=1200*6/10; break; case 3: if(time[2]==0) price=1200; else if(time[2]==4||time[2]==5||time[2]==11||time[2]==12||time[2]==18||time[2]==19||time[2]==25||time[2]==26) price=1200*8/10; else price=1200*6/10; break; case 4: if(time[2]==4) price=1200; else if(time[2]==1||time[2]==2||time[2]==8||time[2]==9||time[2]==15||time[2]==16||time[2]==22||time[2]==23||time[2]==29||time[2]==30) price=1200*8/10; else price=1200*6/10; break; case 5: if(time[2]==1||time[2]==30) {price=1200;} else if(time[2]==6||time[2]==7||time[2]==13||time[2]==14||time[2]==20||time[2]==21||time[2]==27||time[2]==28) price=1200 * 8 / 10; else price=1200 * 6 / 10; break; case 6: if(time[2]==0) price=1200; else if(time[2]==3||time[2]==4||time[2]==10||time[2]==11||time[2]==17||time[2]==18||time[2]==24||time[2]==25) price=1200*8/10; else price=1200*6/10; break; case 7: if(time[2]==0) price=1200; else if(time[2]==1||time[2]==2||time[2]==8||time[2]==9||time[2]==15||time[2]==16||time[2]==22||time[2]==23||time[2]==29||time[2]==30) price=1200*8/10; else price=1200*6/10; break; case 8: if(time[2]==0) price=1200; else if(time[2]==5||time[2]==6||time[2]==12||time[2]==13||time[2]==19||time[2]==20||time[2]==26||time[2]==27) price=1200*8/10; else price=1200*6/10; break; case 9: if(time[2]==0) price=1200; else if(time[2]==2||time[2]==3||time[2]==9||time[2]==10||time[2]==16||time[2]==17||time[2]==23||time[2]==24||time[2]==30) price=1200*8/10; else price=1200*6/10; break; case 10: if(time[2]==1||time[2]==4) price=1200; else if(time[2]==7||time[2]==8||time[2]==14||time[2]==15||time[2]==21||time[2]==22||time[2]==28||time[2]==29) price=1200*8/10; else price=1200*6/10; break; case 11: if(time[2]==0) price=1200; else if(time[2]==4||time[2]==5||time[2]==11||time[2]==12||time[2]==18||time[2]==19||time[2]==25||time[2]==26) price=1200*8/10; else price=1200*6/10; break; case 12: if(time[2]==0) price=1200; else if(time[2]==2||time[2]==3||time[2]==9||time[2]==10||time[2]==16||time[2]==17||time[2]==23||time[2]==24||time[2]==30||time[2]==31) price=1200*8/10; else price=1200*6/10; break; } {System.out.println("the price is "+price * amount);} {System.out.println("\n");} } }

  • 0

    回答

  • 6

    浏览

源代码中显示 <img th:src="@{/images/123.jpg}" alt="" class="ui avatar image"> 没有把里面的@{}里面的资源读取出来 这是怎么回事   后来发现好像是thymeleaf没起作用,我换代码块在浏览器中还是一样的

  • 3

    回答

  • 16

    浏览

假设已知数据库中存在某条数据时,我们再去插入一条一样的数据(主键冲突的数据),但是并不想提前查询一下也不想数据库报错,有什么处理方式?

回答 He_mengcheng
采纳率66.7%
5小时前
  • 1

    回答

  • 9

    浏览

怎么输出的没有空格呢??各位大神们看看我哪有问题

回答 qq_57148473
采纳率100%
5小时前
  • 0

    回答

  • 3

    浏览

谷歌浏览器里点进搜狗搜索时网址框里显示不安全,并自动跳转到百度搜索界面。怎么破?

  • 1

    回答

  • 5

    浏览

@Select("select * from orders where `phoneNum` = #{phoneNum} and `finishTime` is null") @Results({ @Result(property = "task",column = "taskId", one = @One(select = "com.example.ProjectPractice.Dao.taskDao.getTaskByTaskId")) }) List<Orders> getOrderingByPhoneNum(String phoneNum); 样的代码进行查询,根据order中的taskId去task表中找到对应的task,但是在最后返回的结果中: [Orders{orderId=1, taskId=null, phoneNum='155', receiveTime=Mon Apr 12 22:07:34 GMT+08:00 2021, finishTime=Mon Apr 12 23:14:02 GMT+08:00 2021, task=Task{taskId=6, phoneNum='15505422837', taskTitle='学习服务', taskType=4, taskReward=250, taskContent='学习学习', taskInTime=Sun Apr 11 14:41:51 GMT+08:00 2021, taskOutTime=Sat May 01 14:41:56 GMT+08:00 2021, taskState=2, taskPeoNum=5}}] 找到了符合的结果为taskId = 6的task但是order中的taskId外键却成了null? 很是不解???

  • 0

    回答

  • 3

    浏览

想问关于keil写led灯闪烁的问题

  • 0

    回答

  • 4

    浏览

VS中c++项目导出dll文件给后面C#的winform引用其中的函数,但是引用不成功,导出的dll文件进行regsrv 注册时显示报错

回答 赧然的贼
采纳率0%
6小时前
  • 0

    回答

  • 4

    浏览

最近在回顾spring配置 <!-- spring的标签 --> <context:property-placeholder location="classpath:db.properties" /> <bean class="org.mybatis.spring.SqlSessionFactoryBean"> <property name="configLocation" value="classpath:mybatis-config.xml" /> <property name="dataSource" ref="dataSource" /> </bean> <!-- mybatis里面的标签 --> <mappers> <mapper resource="com/mapper/CountryMapper.xml" /> </mappers> 类似比如还有<bean class="..."/>,这个自己能相通,通过全限定名去找到class创建对象。 那么这些配置在加载文件的时候,为什么有些需要加classpath:... ,有些文件只需要配置包名+类名,比如上面加载mapper,类似于全限定名就能找到文件。 我的疑问,都是去找文件的配置,为什么会出现这个差别。 百度实在找不到,没人回答我只能这样想了,配置文件需要加classpath,代码直接全限定名就行了。

回答 春雨S
采纳率100%
6小时前