正在回答 回答被采纳积分+1
class Solution {
public:
bool canJump(vector<int>& nums) {
const int n = nums.size();
bool dp[n];
memset(dp, 0, sizeof(dp));
dp[0] = 1; //第0位能够到达
for(int i = 0; i < n; ++i)
if(dp[i]) //如果第i位能够到达
for(int j = 1; j <= nums[i] && i + j < n; ++j)
dp[i + j] = 1; //它的后nums[i]位也能到达
return dp[n - 1];
}
};
class Solution {
public:
bool canJump(vector<int>& nums) {
const int n = nums.size();
bool dp[n];
memset(dp, 0, sizeof(dp));
dp[0] = 1; //第0位能够到达
for(int i = 0; i < n; ++i)
if(dp[i]) //如果第i位能够到达
for(int j = 1; j <= nums[i] && i + j < n; ++j)
dp[i + j] = 1; //它的后nums[i]位也能到达
return dp[n - 1];
}
};
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<!--type-->
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>HTTP 404 您所访问的页面不存在</title>
<style>
*{margin:0;padding:0;}
.wrong-warp{width:960px;margin:100px auto 0;background:#fff;}
.wrong-warp img,.wrong-warp p{float:left;height:216px;line-height:216px;color:#a3a3a3;font-size:18px;font-family:"微软雅黑";}
.wrong-warp img{margin:0 37px 0 150px;}
.wrong-warp p a{color:#c9394a;text-decoration:none;}
.wrong-warp p a:hover{text-decoration:underline;}
.wrong{ width: 239px; height: 216px; display: block; margin: 0 37px 0 150px; background-position: left top; float: left; }
</style>
</head>
<body>
<div class="wrong-warp">
<div class="wrong"></div>
<p>您访问的页面不存在,回<a href="/">首页</a>再瞅瞅!</p>
</div>
</body>
</html>
<?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>com.imooc</groupId>
<artifactId>mybatis</artifactId>
<version>1.0-SNAPSHOT</version>
<repositories>
<repository>
<id>aliyun</id>
<name>aliyun</name>
<url>https://maven.aliyun.com/repository/public</url>
</repository>
</repositories>
<dependencies>
<dependency>
<groupId>org.mybatis</groupId>
<artifactId>mybatis</artifactId>
<version>3.5.1</version>
</dependency>
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>5.1.47</version>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.12</version>
</dependency>
<dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-classic</artifactId>
<version>1.2.3</version>
</dependency>
<dependency>
<groupId>com.github.pagehelper</groupId>
<artifactId>pagehelper</artifactId>
<version>5.1.10</version>
</dependency>
<dependency>
<groupId>com.mchange</groupId>
<artifactId>c3p0</artifactId>
<version>0.9.5.4</version>
</dependency>
</dependencies>
</project>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <!--type--> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>HTTP 404 您所访问的页面不存在</title> <style> *{margin:0;padding:0;} .wrong-warp{width:960px;margin:100px auto 0;background:#fff;} .wrong-warp img,.wrong-warp p{float:left;height:216px;line-height:216px;color:#a3a3a3;font-size:18px;font-family:"微软雅黑";} .wrong-warp img{margin:0 37px 0 150px;} .wrong-warp p a{color:#c9394a;text-decoration:none;} .wrong-warp p a:hover{text-decoration:underline;} wrong{ width: 239px; height: 216px; display: block; margin: 0 37px 0 150px; background-position: left top; float: left; } </style> </head> <body> <div class="wrong-warp"> <div class="wrong"></div> <p>您访问的页面不存在,回<a href="/">首页</a>再瞅瞅!</p> </div> </body> </html>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<!--type-->
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>HTTP 404 您所访问的页面不存在</title>
<style>
*{margin:0;padding:0;}
.wrong-warp{width:960px;margin:100px auto 0;background:#fff;}
.wrong-warp img,.wrong-warp p{float:left;height:216px;line-height:216px;color:#a3a3a3;font-size:18px;font-family:"微软雅黑";}
.wrong-warp img{margin:0 37px 0 150px;}
.wrong-warp p a{color:#c9394a;text-decoration:none;}
.wrong-warp p a:hover{text-decoration:underline;}
wrong{ width: 239px; height: 216px; display: block; margin: 0 37px 0 150px; background-position: left top; float: left; }
</style>
</head>
<body>
<div class="wrong-warp">
<div class="wrong"></div>
<p>您访问的页面不存在,回<a href="/">首页</a>再瞅瞅!</p>
</div>
</body>
</html>
aaaaaaaaaaaaaaaaaaaaaaaaaaaaa
恭喜解决一个难题,获得1积分~
来为老师/同学的回答评分吧
0 星