- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- namespace puke
- {
- class Program
- {
- static void Main(string[] args)
- {
- int[] nums = {2,3,4,5,6,3};
- int temp, last, count;
- bool win=false;
- //List<int> row = new List<int>();
- //冒泡排序
- for (int i = 0; i < nums.Length; i++)
- {
- for (int j = i + 1; j < nums.Length; j++)
- {
- if (nums[i] > nums[j])
- {
- temp = nums[i];
- nums[i] = nums[j];
- nums[j] = temp;
- }
- }
- }
- //查找连续牌
- count = 1;
- for (int i = 1; i < nums.Length; i++)
- {
- if (nums[i] - nums[i - 1] == 1)
- {
- count++;
- if (count == 5) win = true;
- }
- else if (nums[i] - nums[i - 1] == 0) ;
- else count = 1;
- }
- if (win) Console.WriteLine("Win!");
- else Console.WriteLine("Lost!");
- Console.ReadKey();
- }
- }
- }
复制代码 |