下面题目中有个别题用到了尚未讲解的知识,但是每一题至少能做出一两步,或者写出一个暴力解。能做到哪做到哪吧。
VIJOS 1102 陶陶摘苹果(NOIp 2005 普及组)
VIJOS 1445 陶陶抢苹果
VIJOS 1291 苹果摘陶陶
(我才不会告诉你还有一道陶陶吃苹果、一道陶陶玩红警呢)
Euler 15 Lattice paths
Euler 67 Maximum path sum II
/* | |
* Hacker: Chen Ruichao <sheep0x@berkeley.edu> | |
* Date: 2016-02-02 -0800 | |
* | |
* Much of the code comes from Piazza, so maybe the copyright of this code | |
* belongs to them. In case parts of the hack can be attributed to me, you | |
* may assume the Apache License, Version 2.0. | |
* Disclaimer: I'm not a lawyer and what's written above is probably not | |
* legally effective. | |
*/ |
#! /usr/bin/env bash | |
UA='Mozilla/5.0 (compatible, MSIE 11, Windows NT 6.3; Trident/7.0; rv:11.0) like Gecko' | |
echo 'Please make sure you want to download into CWD' >&2 | |
IFS='' read -p 'url> ' bilibili_url # not tested, not sure if it works like raw_input() | |
IFS='' read -p 'fname> ' fname | |
# get e01 https://www.foo.org | |
function get() { |
下面题目中有个别题用到了尚未讲解的知识,但是每一题至少能做出一两步,或者写出一个暴力解。能做到哪做到哪吧。
VIJOS 1102 陶陶摘苹果(NOIp 2005 普及组)
VIJOS 1445 陶陶抢苹果
VIJOS 1291 苹果摘陶陶
(我才不会告诉你还有一道陶陶吃苹果、一道陶陶玩红警呢)
Euler 15 Lattice paths
Euler 67 Maximum path sum II
随便扯一个61A的题目好了(其实是我太懒不想找题...)
不知道你还记得不记得61A的某个MT的leaps那道题。
有一排N个宝藏,从左到右每个宝藏价值分别为vi。地精可以拿走其中一些宝藏,但是不能取相邻的宝藏。求最大价值和。
例如有6个宝藏,价值分别为2 5 2 1 4 1。我可以取2 2 4、5 1 1、5 4等等,但是不能取2 5 2,因为2和5是相邻的。
令f[i]为前i个宝藏中取走若干个所能获得的最大收益
易知,f[1] = v[1],f[2] = max(v[1], v[2])(为什么?)
f[i] = max(f[i-1], f[i-2] + v[i])
answer = f[N]
/* | |
* Copyright 2015 Chen Ruichao <linuxer.sheep.0x@gmail.com> | |
* | |
* Licensed under the Apache License, Version 2.0 (the "License"); | |
* you may not use this file except in compliance with the License. | |
* You may obtain a copy of the License at | |
* | |
* http://www.apache.org/licenses/LICENSE-2.0 | |
* | |
* Unless required by applicable law or agreed to in writing, software |
import java.util.Scanner; | |
import java.util.Locale; | |
import java.io.PrintStream; | |
public class /* name */ { | |
private static final Scanner stdin; | |
private static final PrintStream stdout = System.out; | |
private static final PrintStream stderr = System.err; | |
static { |
# | |
# Copyright 2015 Chen Ruichao <linuxer.sheep.0x@gmail.com> | |
# | |
# Licensed under the Apache License, Version 2.0 (the "License"); | |
# you may not use this file except in compliance with the License. | |
# You may obtain a copy of the License at | |
# | |
# http://www.apache.org/licenses/LICENSE-2.0 | |
# | |
# Unless required by applicable law or agreed to in writing, software |