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;
- using System.Threading.Tasks;
- using System.Text.RegularExpressions;
- using System.IO;
- namespace ConsoleApp1
- {
- struct item : IComparable<item>
- {
- int type;
- int price;
- int sort;
- public int count;
- public item(int t, int p, int s, int c)
- {
- type = t;
- price = p;
- sort = s;
- count = c;
- }
- public item(string[] a)
- {
- type = int.Parse(a[0]);
- price = int.Parse(a[1]);
- sort = int.Parse(a[2]);
- count = int.Parse(a[3]);
- }
- public string Print()
- {
- return string.Join(" ", type, price, sort, count);
- }
- public int CompareTo(item obj)
- {
- if (this.count > obj.count)
- return 1;
- else if (this.count < obj.count)
- return -1;
- return 0;
- }
- };
- class Program
- {
- static void Main()
- {
- using (StreamReader input = new StreamReader("d:/input.txt"))
- {
- using (StreamWriter output = new StreamWriter("d:/output.txt", false))
- {
- int n = int.Parse(input.ReadLine());
- item[] a = new item[n];
- for (int i = 0; i < n; i++)
- {
- string[] line = input.ReadLine().Split();
- a[i] = new item(line);
- }
- int e = int.Parse(input.ReadLine());
- var b = from v in a
- where v.count < e
- orderby v
- select v;
- foreach (var v in b)
- output.WriteLine(v.Print());
- }
- }
- }
- }
- }
- /*
- 5
- 1 12 3 5
- 1 32 4 4
- 2 23 1 5
- 1 42 6 7
- 3 3 3 3
- 6
- */
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement