avatar
JOKE版来发展下?# Joke - 肚皮舞运动
s*g
1
请问现在去大使馆为小孩子申请旅行证, 还需要小孩子亲自到大使馆吗?
旅行证可以加急当天拿到吗?
不知道该发到哪个版, 这里人气旺, 就发到这里了。
谢谢。
avatar
b*g
2
You are given a game board that contains a four by four (4x4) array of
pieces. The pieces can be one of six shapes and can be one of six colors
If the board contains 4 pieces of the same shape and same color, the board
contains a winning pattern.
public enum Color
{
Red,
Blue,
Green,
Yellow,
Black,
Purple
}
public enum Shape
{
Square,
Triangle,
Circle,
Star,
Pentagon,
Octagon
}
public class Piece
{
public Color color;
public Shape shape;
public bool Equals(Piece compareTo) {};
}
public class Board
{
public Piece[,] position = new Piece[4,4];
public void Board(){ /*completely builds the board*/};
public void MakeRandomBoard(){};
public piece GetPiece(int x) {};
public bool IsWinner() {};
}
Write the code to detect when a winning pattern is present in a board.
---_---------
my solution is to use hashtable to record pieces and counts, if anyone is 4,
return true. for hashtable, i did not give a hash fuction. any idea?
we can also use 6*6 array to record counts.
avatar
h*d
3
哪里的家具便宜?有没有二手市场之类的?
前几天在Rowland heights mall里面看见一个同胞开的家具店,里面mattress什么的50
% off,书柜什么的就不清楚是不是便宜了
avatar
w*s
4
如图
avatar
d*a
5
哪个领事馆?
规定不一样。

【在 s*********g 的大作中提到】
: 请问现在去大使馆为小孩子申请旅行证, 还需要小孩子亲自到大使馆吗?
: 旅行证可以加急当天拿到吗?
: 不知道该发到哪个版, 这里人气旺, 就发到这里了。
: 谢谢。

avatar
r*c
6
using System;
using System.Collections.Generic;
namespace WinningGame
{
class Program
{
static void Main(string[] args)
{
int nCount = 0;
int nTotalGames = 1000;
for (int i = 0; i < nTotalGames; i++)
{
Board bd = new Board();
//bd.PrintBoard();
bool bResult = bd.IsWinner();
if (bResult)
{
nCount++;
bd.PrintBoard();
}
Console.WriteLine(string.Format("Game is {0}", bResult ? "
won" : "lost"));
}
Console.WriteLine(string.Format("{0} Games out of {1} are
winning ones", nCount, nTotalGames));
return;
}
}

public enum Color{
UNKNOWN = -1, Red = 0, Blue, Green, Yellow, Black, Purple
}

public enum Shape{
UNKNOWN = -1, Square = 0, Triangle, Circle, Star, Pentagon, Octagon
}

public class Piece
{
public Color color;
public Shape shape;
public Piece(int c, int s) { color = (Color)c; shape = (Shape)s; }
public bool Equals(Piece rhs) { return this.color == rhs.color &&
this.shape == rhs.shape;}
public override string ToString(){
return string.Format("({0}|{1})", Enum.GetName(typeof(Color),
color), Enum.GetName(typeof(Shape), shape));
}
}
public class PiecePlus
{
public Piece Piece {get; set;}
public int Row {get; set;}
public int Col {get; set;}
public PiecePlus(int row, int col, Piece p) { Piece = p; Row = row;
Col = col; }
public bool Equals(PiecePlus rhs) { return this.Piece.Equals(rhs.
Piece) && this.Row == rhs.Row && this.Col == rhs.Col; }
public override string ToString(){
return string.Format("pattern: {0}", Piece.ToString());
}
}
public class Board
{
public static readonly int boardLength = 4;
public static readonly int nMatchCountForWin = 4;
public static readonly int nNumOfEleInColorEnum = Enum.GetNames(
typeof(Color)).Length - 1; // excluding UNKNOWN
public static readonly int nNumOfEleInShapeEnum = Enum.GetNames(
typeof(Shape)).Length - 1; // excluding UNKNOWN
public static readonly PiecePlus DefaultPiecePlus = new PiecePlus(-1
, -1, new Piece(-1, -1));
public Piece[,] position = new Piece[boardLength, boardLength];
public Board(){
MakeRandomBoard();
}
public void MakeRandomBoard(){
Random rdm = new Random((int)DateTime.Now.Ticks);
for(int i=0; ifor (int j = 0; j < boardLength; ++j){
position[i, j] = new Piece(rdm.Next() %
nNumOfEleInColorEnum, rdm.Next() % nNumOfEleInShapeEnum);
}
}
}
public void PrintBoard()
{
for (int i = 0; i < boardLength; ++i){
for (int j = 0; j < boardLength; ++j){
Console.Write(position[i, j].ToString());
if (j <= boardLength - 1)
Console.Write("\t");
}
Console.Write("\n");
}
}
private bool isWinningImpl(int row, int col, Piece p, int
nRequirdMatches, HashSet hs, out PiecePlus ppPattern)
{
PiecePlus temp = new PiecePlus(row, col, p);
if (hs.Contains(temp)){
ppPattern = temp;
return true;
}
int nCount = 0;
for(int j=col; jif(p.Equals(position[row, j]))
nCount++;
}
if (nCount >= nRequirdMatches){
if (!hs.Contains(temp))
hs.Add(temp);
ppPattern = temp;
return true;
}
for (int i = row + 1; i < boardLength; ++i){ //avoid double
counting
if (p.Equals(position[i, col]))
nCount++;
}
if (nCount >= nRequirdMatches){
if (!hs.Contains(temp))
hs.Add(temp);
ppPattern = temp;
return true;
}
if (row < boardLength - 1 && col < boardLength - 1)
return isWinningImpl(row + 1, col + 1, p, nRequirdMatches -
nCount, hs, out ppPattern);
ppPattern = DefaultPiecePlus;
return false;
}
public bool IsWinner()
{
HashSet hs = new HashSet();
PiecePlus ppPattern;
for (int i = 0; i < boardLength; ++i){
for (int j = 0; j < boardLength; ++j){
if (isWinningImpl(0, 0, position[i, j],
nMatchCountForWin, hs, out ppPattern)){
Console.WriteLine(string.Format("winning pattern: {0
}", ppPattern.ToString()));
return true;
}
}
}
return false;
}
}
}
avatar
b*t
7
50% off啊,这还不够便宜!

50

【在 h***d 的大作中提到】
: 哪里的家具便宜?有没有二手市场之类的?
: 前几天在Rowland heights mall里面看见一个同胞开的家具店,里面mattress什么的50
: % off,书柜什么的就不清楚是不是便宜了

avatar
z*3
8
坐等河马
avatar
s*g
9
是纽约的领事馆。

【在 d*********a 的大作中提到】
: 哪个领事馆?
: 规定不一样。

avatar
r*c
10
天天50%off,人家就没原价卖过东西

【在 b*****t 的大作中提到】
: 50% off啊,这还不够便宜!
:
: 50

avatar
l*o
11
同意楼上,这个题目,也就河马和赵云能顶上。
avatar
d*a
12
有人前不久办过,要带小孩去。
加急: 一般不可以。你可以试着给他们发邮件,说明具体理由和困难。他们的电话估
计你打不通的。

【在 s*********g 的大作中提到】
: 是纽约的领事馆。
avatar
g*n
13
50%off以后卖的才是原价

【在 r*c 的大作中提到】
: 天天50%off,人家就没原价卖过东西
avatar
z*3
14
赵云是谁?

【在 l*****o 的大作中提到】
: 同意楼上,这个题目,也就河马和赵云能顶上。
avatar
k*0
15
要买二手的话,每天早上听1300电台,不少人在那卖二手家具的;另外在EL MONTE的顺
发超市边上有几家二手家具公司的,可以去那看看。

50

【在 h***d 的大作中提到】
: 哪里的家具便宜?有没有二手市场之类的?
: 前几天在Rowland heights mall里面看见一个同胞开的家具店,里面mattress什么的50
: % off,书柜什么的就不清楚是不是便宜了

avatar
l*o
16
另外一个诗人。
很久没见了,或者我把名字记错了。

【在 z*****3 的大作中提到】
: 赵云是谁?
avatar
z*n
17
前面梁/沈/胡的title都好理解,撸大师的“风弹琵琶”一句
比较费解,难道这琵琶可以发次声波击中空气中的particle
让它们失去浮力?

【在 w***s 的大作中提到】
: 如图
avatar
z*3
18
这就是赵云?

【在 z*****n 的大作中提到】
: 前面梁/沈/胡的title都好理解,撸大师的“风弹琵琶”一句
: 比较费解,难道这琵琶可以发次声波击中空气中的particle
: 让它们失去浮力?

avatar
s*e
19
然!

【在 z*****3 的大作中提到】
: 这就是赵云?
avatar
l*e
20
河马----一纸情话,比不过半版笑话
avatar
s*e
21

难道不是马甲么?

【在 l*****o 的大作中提到】
: 同意楼上,这个题目,也就河马和赵云能顶上。
avatar
o*1
22
毛主席《白雪红梅,留不住那霸王银枪》

【在 l*****e 的大作中提到】
: 河马----一纸情话,比不过半版笑话
avatar
z*3
23
这个比原文的好,引经据典。

【在 o******1 的大作中提到】
: 毛主席《白雪红梅,留不住那霸王银枪》
avatar
d*0
24
老舍 《残雾月牙,抓不住的似水年华》

【在 o******1 的大作中提到】
: 毛主席《白雪红梅,留不住那霸王银枪》
avatar
H*g
25
诗人出手果然不凡。

【在 o******1 的大作中提到】
: 毛主席《白雪红梅,留不住那霸王银枪》
avatar
a*o
26
《白雪红梅,留不住那银蛇蜡象》

【在 o******1 的大作中提到】
: 毛主席《白雪红梅,留不住那霸王银枪》
avatar
z*n
27
窑洞春深,关不住那萍珍慧凤。

【在 a****o 的大作中提到】
: 《白雪红梅,留不住那银蛇蜡象》
avatar
l*y
28
红楼梦《扯你娘的臊,又欠你老子捶你》
相关阅读
logo
联系我们隐私协议©2024 redian.news
Redian新闻
Redian.news刊载任何文章,不代表同意其说法或描述,仅为提供更多信息,也不构成任何建议。文章信息的合法性及真实性由其作者负责,与Redian.news及其运营公司无关。欢迎投稿,如发现稿件侵权,或作者不愿在本网发表文章,请版权拥有者通知本网处理。