Дата активности | Консольный раздел | Прогресс | ||
---|---|---|---|---|
2019-07-23 | task1 | Лирика | 8 % | |
2019-07-23 | task1 | Строки | 100 % | |
2019-07-16 | task1 | Целые числа | 100 % | |
2019-07-16 | book | 110. Функции | 100 % | |
2019-07-16 | task1 | Семантика | 100 % | |
2019-07-09 | book | 101. Математика | 115 % | |
2019-06-17 | book | 100. Массивы | 100 % | |
2019-06-13 | book | 011. Циклы | 100 % | |
2019-06-11 | book | 001. Числа | 100 % | |
2019-06-11 | book | 010. Условия | 100 % | |
2019-05-31 | book | 000. Строки | 100 % | |
Итого: | 88 % |
И нету смысла делать большой код, который будет только "жрать" память. Вот простой код, возможно кто-то сделает ещё простее)
int count = int.Parse(Console.ReadLine());
Console.WriteLine("{0} {1} {2} {3} {4}", count++, count++, count++, count++, count++);
Console.WriteLine("{0} {1} {2} {3} {4}", --count, --count, --count, --count, --count);
string[] nums = Console.ReadLine().Split();
double a = double.Parse(nums[0]);
double b = double.Parse(nums[1]);
double c = double.Parse(nums[2]);
if (a != 0 && b != 0 && c != 0)
{
double dis = Math.Sqrt(b * b - 4 * a * c);
if (dis == 0)
{ Console.WriteLine("{0:0.000}",-b / (2 * a)); }
else if (dis > 0)
{
double x1 = (-b + dis) / (2 * a);
double x2 = (-b - dis) / (2 * a);
if (x1 < x2) Console.WriteLine("{0:0.000} {1:0.000}", x1, x2);
else Console.WriteLine("{0:0.000} {1:0.000}", x2, x1);
}
else
Console.WriteLine("NO");
}
else if (a == 0 && b != 0 && c != 0)
Console.WriteLine("{0:0.000}", -c / b);
else if (a != 0 && b == 0 && c != 0)
Console.WriteLine("{0:0.000}", Math.Sqrt(-c / a));
else if (a != 0 && b != 0 && c == 0)
{
double x3= 0;
double x4 = -b/a;
if(x3<x4) Console.WriteLine("{0:0.000} {1:0.000}",x3,x4);
else Console.WriteLine("{0:0.000} {1:0.000}",x4,x3);
}
else if(a==0 && b==0 && c!=0) Console.WriteLine("NO");
else if(a==0 && b!=0 && c==0) Console.WriteLine("0.000");
else if(a!=0 && b==0 && c==0) Console.WriteLine("0.000");
else Console.WriteLine("NO");
по моему проблема эта /
/ не правильно ответ дает
А что у Тебя вызвало сложность??
на компе сначала решай для удобства, там же дебагер есть, удобная вещь
У тебя где int и ulong двойные пробелы стоят. Из-за этого с ответом не сходится
string s = Console.ReadLine();
string s1 = Console.ReadLine();
string s2 = Console.ReadLine();
long a = Convert.ToInt64(s);
long b = long.Parse(s1);
long c;
long.TryParse(s2, out c);
Console.WriteLine("{0} {1} {2}", ++a, ++b, ++c);
sbyte x1 = sbyte.MinValue;sbyte x2 = sbyte.MaxValue;
byte y1 = byte.MinValue;byte y2 = byte.MaxValue;
short c1 = short.MinValue;short c2 = short.MaxValue;
ushort z1 = ushort.MinValue; ushort z2 = ushort.MaxValue;
int a1 = int.MinValue; int a2 = int.MaxValue;
uint b1 = uint.MinValue; uint b2 =uint.MaxValue;
long l1 = long.MinValue; long l2 = long.MaxValue;
ulong k1 = ulong.MinValue; ulong k2 = ulong.MaxValue;
Console.WriteLine("sbyte {0} {1}", x1, x2);
Console.WriteLine("byte {0} {1}", y1, y2);
Console.WriteLine("short {0} {1}", c1, c2);
Console.WriteLine("ushort {0} {1}", z1, z2);
Console.WriteLine("int {0} {1}", a1, a2);
Console.WriteLine("uint {0} {1}", b1, b2);
Console.WriteLine("long {0} {1}", l1, l2);
Console.WriteLine("ulong {0} {1}", k1, k2);
string s = Console.ReadLine();
int a = Int32.Parse(s);
int a1=a++;
int a2 = ++a1;
int a3 = ++a2;
int a4 = ++a3;
Console.WriteLine("{0} {1} {2} {3} {4}", --a,a1,a2,a3,++a4);
Console.WriteLine("{0} {1} {2} {3} {4}", a4, a3, a2, a1, a);
Console.WriteLine("sbyte {0} {1}", sbyte.MinValue, sbyte.MaxValue);
Console.WriteLine("byte {0} {1}", byte.MinValue, byte.MaxValue);
Console.WriteLine("short {0} {1}", short.MinValue, short.MaxValue);
Console.WriteLine("ushort {0} {1}", ushort.MinValue, ushort.MaxValue);
Console.WriteLine("int {0} {1}", int.MinValue, int.MaxValue);
Console.WriteLine("uint {0} {1}", uint.MinValue, uint.MaxValue);
Console.WriteLine("long {0} {1}", long.MinValue, long.MaxValue);
Console.WriteLine("ulong {0} {1}", ulong.MinValue, ulong.MaxValue);
робот не дает не верный ответ. Как решить?
int a=Convert.ToInt32(Console.ReadLine());
int c = a / 100;
int v = a % 100;
int x = v / 10;
int y = v % 10;
Console.WriteLine(c+x+y+" "+a*a);
string text =Console.ReadLine();
text = text.Substring(1,text.Length-2);
string t1 = text.TrimStart(' ','\t');
string t2 = text.TrimEnd(' ','\t');
string t3 = text.Trim(' ','\t');
Console.WriteLine("["+t1+"]");
Console.WriteLine("[" + t2 + "]");
Console.WriteLine("[" + t3 + "]");
string text= Console.ReadLine();
string word= Console.ReadLine();
int index =text.IndexOf(' ')+1;
text=text.Insert(index,word+" ");
Console.WriteLine(text);
string text=Console.ReadLine();
string[] str = text.Split(new char[] { ' ', ',','.',':',';','?','!','-' }, StringSplitOptions.RemoveEmptyEntries);
int max = str[0].Length;
for (int i = 0; i < str.Length; i++)
if (max < str[i].Length)
max = str[i].Length;
Console.WriteLine(max);