链接:
POJ 2186 Popular Cows
题意:
每一头牛都希望在牛群里面备受瞩目,在一个牛群中有N头牛(1
输入:
第一行两个整数 N 和 M
第2 到 M + 1 行,两个分开的数 A,B,意味着 A认为 B 更受欢迎。
输出:
被所有牛认为受欢迎的牛的个数
比如输入:
3 3
1 2
2 1...
分类:
其他好文 时间:
2014-06-08 18:20:40
阅读次数:
204
下面说说split函数的用法
def break_words(stuff):
"""This function will break up words for us."""
words = stuff.split(' ')#split('.',1) use '.' split one time
return words
def sort_words(wo...
分类:
编程语言 时间:
2014-06-08 18:19:21
阅读次数:
336
Description
Farmer John wants the cows to prepare for the county jumping competition, so Bessie and the gang are practicing jumping over hurdles. They are getting tired, though, so they want to be ...
分类:
其他好文 时间:
2014-06-08 15:55:10
阅读次数:
199
@Override
public boolean onOptionsItemSelected(MenuItem item) {
switch (item.getItemId()) {
// Respond to the action bar's Up/Home button
case android.R.id.home:
//这里写重写的方法 一定要retrun ...
分类:
其他好文 时间:
2014-06-08 10:39:02
阅读次数:
278
题意:贪吃蛇的题目
思路:BFS+状态的记录,坑了无数发,#include
#include
#include
using namespace std;
const int MAXN = 500000;
bool flag[8],vis[25][25],mp[21][21][16384];
int n,m,l;
int xx[4]={-1,0,1,0}; // up,right,dow,left...
分类:
其他好文 时间:
2014-06-08 10:13:19
阅读次数:
204
Follow up for "Search in Rotated Sorted
Array":What ifduplicatesare allowed?Would this affect the run-time complexity?
How and why?Write a function to...
分类:
其他好文 时间:
2014-06-08 01:19:29
阅读次数:
320
PathsumDescription:Given a binary tree and a
sum, determine if the tree has a root-to-leaf path such that adding up all the
values along the path equa...
分类:
其他好文 时间:
2014-06-08 01:11:46
阅读次数:
395
Follow up for "Unique Paths":Now consider if
some obstacles are added to the grids. How many unique paths would there be?An
obstacle and empty space i...
分类:
其他好文 时间:
2014-06-08 00:33:42
阅读次数:
339
You are given an n x n 2D matrix representing
an image.Rotate the image by 90 degrees (clockwise).Follow up:Could you do this
in-place?实现题。从最外圈顺时针交换,最...
分类:
其他好文 时间:
2014-06-07 20:33:17
阅读次数:
283
Given a binary tree and a sum, determine if the
tree has a root-to-leaf path such that adding up all the values along the path
equals the given sum.Fo...
分类:
其他好文 时间:
2014-06-07 16:55:09
阅读次数:
173