Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
DN3
//Rextester.Program.Main is the entry point for your code. Don't change it. //Compiler version 4.0.30319.17929 for Microsoft (R) .NET Framework 4.5 using System; using System.Collections.Generic; using System.Linq; using System.Text.RegularExpressions; using System.Data; using System.Threading; namespace Rextester { public class Program { public static void Main(string[] args) { //Your code goes here List<string> q = new List<string>(); DataTable dt = new DataTable(); double Value; string[] op = new string[4] {"+","-","*","/"}; for (int i = 0; i<100; i++) { int a = Rand.Next(2,10); int b = Rand.Next(2,10); int c = Rand.Next(2,10); int op1 = Rand.Next(0,4); int op2 = Rand.Next(0,4); //q.Add("4"+"+2"); //q.Add("4+2/2*4"); //q.Add("3*0-2"); q.Add(a+op[op1]+b+op[op2]+c); } foreach (string member in q) { Value = Convert.ToDouble(dt.Compute(member, null)); if (Value%1==0) { Console.WriteLine(member+"="+Value); } } } } /// Rand public static class Rand { /// <summary> /// Random number generator used to generate seeds, /// which are then used to create new random number /// generators on a per-thread basis. /// </summary> private static readonly Random globalRandom = new Random(); private static readonly object globalLock = new object(); /// <summary> /// Random number generator /// </summary> private static readonly ThreadLocal<Random> threadRandom = new ThreadLocal<Random>(NewRandom); /// <summary> /// Creates a new instance of Random. The seed is derived /// from a global (static) instance of Random, rather /// than time. /// </summary> public static Random NewRandom() { lock (globalLock) { return new Random(globalRandom.Next()); } } /// <summary> /// Returns an instance of Random which can be used freely /// within the current thread. /// </summary> public static Random Instance { get { return threadRandom.Value; } } /// <summary>See <see cref="Random.Next()" /></summary> public static int Next() { return Instance.Next(); } /// <summary>See <see cref="Random.Next(int)" /></summary> public static int Next(int maxValue) { return Instance.Next(maxValue); } /// <summary>See <see cref="Random.Next(int, int)" /></summary> public static int Next(int minValue, int maxValue) { return Instance.Next(minValue, maxValue); } /// <summary>See <see cref="Random.NextDouble()" /></summary> public static double NextDouble() { return Instance.NextDouble(); } /// <summary>See <see cref="Random.NextBytes(byte[])" /></summary> public static void NextBytes(byte[] buffer) { Instance.NextBytes(buffer); } public static double NextD(double minValue, double maxValue) { return Instance.NextDouble()*(maxValue-minValue)+minValue; } } }
run
|
edit
|
history
|
help
0
Invalid cast
Basic
concat
Task List
sdfgrthyjuytgr
linked list traversal
наименьшее общее кратное двух чисел a и b
biswa
fsdf
adxsadxcasxsd