文章列表
Hart is engaged in playing an interesting game, Gnome Tetravex, these
days. In the game, at the beginning, the player is given n*n squares.
Each square is divided into four triangles marked four numbers (range
from 0 to 9). In a square, the triangles are the left triangle, the top
triangle, t ...
真的不知道这个题目。。。有什么意思。。
不想解释了。。
直接贴代码了。。想要的就拿去AC好了。
import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;
public class DotheUntwist {
public static void main(String[] args) {
Scanner scaner = new Scanner(System.in);
while(scaner.hasNextLine()){
...
背包问题有很多种,简单背包,物品有价值的背包。下面是个有价值背包的代码。很久以前写的。
import java.util.LinkedList;
import java.util.List;
public class ItemWithWeight {
/**
* @param args
*/
private static Item[] items;
private static int m = 10;
public static void main(String[] args) {
init();
Result currentValue ...
八皇后
问题,是一个古老而著名的问题,是回溯算法的典型例题。该问题是十九世纪著名的数学家高斯
1850年提出:在8X8格的国际象棋
上摆放八个皇后,使其不能互相攻击,即任意两个皇后都不能处于同一行、同一列或同一斜线上,问有多少种摆法。 高斯认为有76种方案。1854年在柏林
的象棋杂志上不同的作者发表了40种不同的解,后来有人用图论的方法解出92种结果。计算机发明后,有多种方法可以解决此问题。
public class EightQueen {
private static int LENGTH = 8;
private static Blank[][] grid = new ...
字符串的最大子串么
代码比较简单。。直接上吧。大学时期的程序
import java.util.LinkedList;
import java.util.List;
public class MaxString {
public static void main(String[] args) {
List<Character> str1 = new LinkedList<Character>();
List<Character> str2 = new LinkedList<Character>();
str1. ...
就是。。经典问题么。。
有很多个加油站,汽车最远跑多少公里,问你在哪几个地方加油可以让加油次数最少
每个加油站距离不同
import java.util.LinkedList;
import java.util.List;
public class CarAndGas {
/**
* @param args
*/
private static int MAX_DISTANCE = 10;
private static int[] distance = {8,3,5,2,4,7,3,3,2,4,6,7};
//private static boolea ...
原题地址:http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemCode=1005
不贴英文了,题目简单
就是两个水杯
A升 和 B升的
。。如何让一个杯子充满C升的水,任意一个都行
不明白的话,去看虎胆龙威3.。里面那个胖子搞BOMB那段,炸学校那个
然后把如何倒的,输出来。
我的做法,好吧。代码比较凌乱,其实就是一个一个试,倒来倒去,然后倒出结果
广度优先搜索,学术名称叫这个
贴代码:
import java.util.LinkedList;
import java.util.Scanner;
public c ...
原题:http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemCode=1004
题目太长了。。。其实很简单
就是能不能把一个字符串
比如:madam
通过栈操作,变成adamm
Sample Input
madam
adamm
Sample Output
[
i i i i o o o i o o
i i i i o o o o i o
i i o i o i o i o o
i i o i o i o o i o
]
如果不行的话
就是空的
[
]
思路:
...
原题地址: http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemCode=1003
On every June 1st, the Children's Day, there will be a game named "crashing balloon" on TV.
The rule is very simple. On the ground there are 100 labeled
balloons, with the numbers 1 to 100. After the referee s ...
ZOJ 1002 Fire Net
- 博客分类:
- 稀烂的算法
原题目链接:http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemCode=1002
Suppose that we have a square city with straight streets. A map of a city is a square
board with n rows and n columns, each representing a street or a piece of wall.
A blockhouse is a small castle that has four openings thr ...
稀烂的算法。。。声明下
- 博客分类:
- 稀烂的算法
放了点算法的东西在这里,我不是什么算法大神。。。
所以。不要问我太多。这个复杂度,那个复杂度的。我不会回复的。
程序也比较稀烂,不过至少可以提交上去AC掉。
OK~
如果要批判我的代码的话,随便吧。。
上班开小差和打Dota空余时间写的。
终于到最后,辞职了
人生其实很迷茫,不知道以后的路会怎么走
一年前,面对众多的offer,选了现在这个6k7,对于一个二本毕业生来说,不错了
尚记得当初的开心与喜悦
但如今,很多东西都变了
写代码对我来说已经觉得很没有意义,一时间找不到该如何去突破自己
不知道自己的瓶颈在哪里
看了很多源代码,很多书,但是却觉得没有意义
想起了很多年前,从80286开始接触计算机
初中用VB
高考考砸,毕业工作
从事开发,一晃就是20年
虽然在同一个城市,但是自己租在外面没有回家
也没有找女朋友,每天不知道自己在干什么
因为不缺钱,技术又不在提升了,所以觉得很没有动力
最后我选择了辞 ...