Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- namespace T_1G
- {
- class Program
- {
- static void Main(string[] args)
- {
- Random rnd = new Random();
- int n = 5000;
- Console.BufferWidth = (int)Math.Max(Math.Min((long)(100) * 6 + 10, (long)(n) * 6 + 10), 100);
- Console.WindowWidth = 100;
- Gauss g = new Gauss(n);
- for (int h = 0; h < 100; h++)
- {
- for (int i = 0; i < n; i++)
- {
- for (int j = 0; j < n; j++)
- {
- g.a[i, j] = rnd.Next(-10, 10);
- }
- }
- for (int i = 0; i < n; i++)
- {
- g.f[i] = 0;
- for (int j = 0; j < n; j++)
- {
- g.f[i] += g.a[i, j];
- }
- }
- if(n <= 100)for (int i = 0; i < n; i++)
- {
- for (int j = 0; j < n; j++)
- {
- Console.Write(String.Format("{0,6:0.00}", g.a[i, j]));
- }
- Console.WriteLine(String.Format("{0,8:0.00}", g.f[i]));
- }
- int r = g.Calc();
- Console.WriteLine();
- if (r == 1)
- {
- Console.WriteLine("Error");
- }
- else
- {
- if (n <= 100) for (int i = 0; i < n; i++)
- {
- for (int j = 0; j < n; j++)
- {
- Console.Write(String.Format("{0,5:0.00}", g.a[i, j]));
- }
- Console.WriteLine(String.Format("{0,7:0.00}", g.f[i]));
- }
- double delta = 0;
- for (int i = 0; i < n; i++) delta += Math.Abs(1 - g.f[i]);
- Console.WriteLine(String.Format("{0,15:0.000000000000}", delta));
- }
- Console.ReadKey();
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement