zoukankan      html  css  js  c++  java
  • c#基础 第三讲

                Random r = new Random();                 string x, y;             while (true)             {                                int a = r.Next(0, 3);                 int b = r.Next(0, 3);

                    switch (a)                 {                     case 0://剪刀                         x = "剪刀";                         break;                     case 1://石头                         x = "石头";                         break;                     case 2://布                         x = "布";                         break;                     default:                         x = "耍赖";                         break;                 }                 switch (b)                 {                     case 0://剪刀                         y = "剪刀";                         break;                     case 1://石头                         y = "石头";                         break;                     case 2://布                         y = "布";                         break;                     default:                         y = "耍赖";                         break;                 }

                    Console.WriteLine("x出的是" + x);                 Console.WriteLine("y出的是" + y);                 string jg = "";                                if (a == b)                 {                     jg = "平局";                 }                 else if ( a > b)                 {                     if (a==2&&b==0)                     {                         jg = "y胜利";                     }                     else                     {                         jg = "x胜利";                     }                                     }                 else if (b > a)                 {                     if (b == 2 && a == 0)                     {                         jg = "x胜利";                     }                     else                     {                         jg = "y胜利";                     }                 }

                    Console.WriteLine(jg);

                    Console.ReadLine();             }

  • 相关阅读:
    LUOGU P3355 骑士共存问题(二分图最大独立集)
    LUOGU P1453 城市环路(基环树+dp)
    BZOJ 1441 Min (裴蜀定理)
    LUOGU P1342 请柬(最短路)
    LUOGU P1186 玛丽卡
    LUOGU P2580 于是他错误的点名开始了(trie树)
    l洛谷 NOIP提高组模拟赛 Day2
    bzoj 4372 烁烁的游戏——动态点分治+树状数组
    bzoj 3730 震波——动态点分治+树状数组
    hdu 5909 Tree Cutting——点分治(树形DP转为序列DP)
  • 原文地址:https://www.cnblogs.com/Kare/p/4307281.html
Copyright © 2011-2022 走看看