1-Laboratoriya ishi. Mavzu: Chiziqli qidiruv algoritmi 12-topshiriq



Download 267,96 Kb.
Pdf ko'rish
Sana26.05.2022
Hajmi267,96 Kb.
#610252
Bog'liq
1-tajriba.



971-19 guruh talabasi
Rajapov Doniyor 
 
1-Laboratoriya ishi. 
Mavzu: Chiziqli qidiruv algoritmi 
 
12-topshiriq 
During a preparation of programming contest, its jury is usually faced with 
many difficult tasks. One of them is to select a problem simple enough to most, if 
not all, contestants to solve.
The difficulty here lies in diverse meanings of the term “simple” amongst the jury 
members. So, the jury uses the following procedure to reach a consensus: each 
member weights each proposed problem with a positive integer “complexity 
rating” (not necessarily different for different problems). The jury member calls 
“simplest” those problems that he gave the minimum complexity rating, and 
“hardest” those problems that he gave the maximum complexity rating.
The ratings received from all jury members are then compared, and a problem is 
declared as “very simple”, if it was called as “simplest” by more than a half of the 
jury, and was called as “hardest” by nobody.
Input
The first line of input file contains integers 
N
and 
P
(1
N

P
100), the number 
of jury members and the number of problems. The following 
N
lines 
contain 
P
integers in range from 0 to 1000 each — the complexity ratings.
Output
Output file must contain an ordered list of “very simple” problem numbers
separated by spaces. If there are no such problems, output must contain a single 
integer 0 (zero).
Samples

Input
Output
1
4 4
1 1 1 2
5 900 21 40
10 10 9 10
3 4 3 5
3
namespace Tajriba1Topshiriq12 

internal class Program 

public static void Main(string[] args) 



string setir = Console.ReadLine(); 
var massiv = setir.Split(' '); 
int n = int.Parse(massiv[0]); 
int k = int.Parse(massiv[1]); 
int[] a = new int[k]; 
int[] b = new int[k]; 
int t = n/2; 
for (int i = 0; i < n; i++) 

int max = 0; 
int min = 1000; 
setir = Console.ReadLine(); 
massiv = setir.Split(' '); 
for (int j = 0; j < k; j++) 

a[j] = int.Parse(massiv[j]); 
min = Math.Min(min, a[j]); 
max = Math.Max(max, a[j]); 

for (int j = 0; j < k; j++) 

if (a[j] == max) b[j] = -1; 
else if (a[j] == min) if (b[j] >= 0) b[j]++; 


string cavab = ""; 
for (int i = 0; i < k; i++) if (b[i] > t) cavab = cavab + " " + (i + 1); 
Console.WriteLine(cavab == "" ? "0" : cavab.Substring(1)); 






Download 267,96 Kb.

Do'stlaringiz bilan baham:




Ma'lumotlar bazasi mualliflik huquqi bilan himoyalangan ©hozir.org 2024
ma'muriyatiga murojaat qiling

kiriting | ro'yxatdan o'tish
    Bosh sahifa
юртда тантана
Боғда битган
Бугун юртда
Эшитганлар жилманглар
Эшитмадим деманглар
битган бодомлар
Yangiariq tumani
qitish marakazi
Raqamli texnologiyalar
ilishida muhokamadan
tasdiqqa tavsiya
tavsiya etilgan
iqtisodiyot kafedrasi
steiermarkischen landesregierung
asarlaringizni yuboring
o'zingizning asarlaringizni
Iltimos faqat
faqat o'zingizning
steierm rkischen
landesregierung fachabteilung
rkischen landesregierung
hamshira loyihasi
loyihasi mavsum
faolyatining oqibatlari
asosiy adabiyotlar
fakulteti ahborot
ahborot havfsizligi
havfsizligi kafedrasi
fanidan bo’yicha
fakulteti iqtisodiyot
boshqaruv fakulteti
chiqarishda boshqaruv
ishlab chiqarishda
iqtisodiyot fakultet
multiservis tarmoqlari
fanidan asosiy
Uzbek fanidan
mavzulari potok
asosidagi multiservis
'aliyyil a'ziym
billahil 'aliyyil
illaa billahil
quvvata illaa
falah' deganida
Kompyuter savodxonligi
bo’yicha mustaqil
'alal falah'
Hayya 'alal
'alas soloh
Hayya 'alas
mavsum boyicha


yuklab olish