fork download
  1. #include <iostream>
  2. #include <cmath>
  3. #include <string>
  4. #include <iomanip>
  5. using namespace std;
  6.  
  7. int main()
  8. {
  9. ios_base::sync_with_stdio(false);
  10. int t,s,suma,n,h,d,j,q,x,g,o,v,belka,g2,f4,l,l2,l3,l4;
  11. int nr_belki[100],konstrukcyjny[100],kolejnosc[100],dlugosc[100];
  12. char imiona[100];
  13. float w,b,wiatr,v2,v3,a,min,max,m,f3;
  14. float wyniki[1000],p_wiatr[100],p_belka[100],ocena[5],punkty[100];
  15.  
  16. string imie,nazwisko,odl;
  17.  
  18. cin>>t;
  19.  
  20. for(int i=0; i<t; i++)
  21. {
  22. h=0;
  23. l=0;
  24. v=0;
  25. d=0;
  26. g=0;
  27. suma=0;
  28. cin>>w>>b>>q>>s>>n;
  29. p_wiatr[i]=w;
  30. p_belka[i]=b;
  31. konstrukcyjny[i]=q;
  32. nr_belki[i]=s;
  33. for(int c=0; c<n; c++)
  34. {
  35. cin>>imie>>nazwisko>>wyniki[c]>>wiatr>>belka;
  36. kolejnosc[c]=c;
  37.  
  38. //ZLICZANIE OCEN SEDZIOW:
  39. for(int z=0; z<5; z++)
  40. {
  41. if(z==0)
  42. {
  43. cin>>min;
  44. max==min;
  45. punkty[c]=min;
  46. }
  47. else
  48. {
  49. cin>>a;
  50. punkty[c]+=a;
  51. if(a>max)
  52. max=a;
  53. else if(a<min)
  54. min=a;
  55. }
  56. }
  57. min+=max;
  58. punkty[c]-=min;
  59.  
  60. //ZLICZANIE PUNKTOW ZA ODLEGLOSC:
  61. if(q>160)
  62. m=1.2;
  63. else if(q>100)
  64. m=1.8;
  65. else
  66. m=2;
  67.  
  68. if(wyniki[c]>=q)
  69. {
  70. punkty[c]+=60;
  71. wyniki[c]-=q;
  72.  
  73. punkty[c]+=wyniki[c]*m;}
  74. else
  75. {
  76. punkty[c]+=60;
  77. wyniki[c]-=q;
  78. wyniki[c]*=(-1);
  79. punkty[c]+=wyniki[c]*m;
  80. }
  81.  
  82. //WIATR:
  83. v2=p_wiatr[i]*wiatr;
  84. punkty[c]+=v2;
  85.  
  86. //BELKA:
  87.  
  88. v3=s-belka;
  89. v3*=p_belka[i];
  90. punkty[c]+=v3;
  91.  
  92. //WPISYWANIE NAZWISK:
  93. dlugosc[l++]=imie.length();
  94. dlugosc[l++]=nazwisko.length();
  95. o=0;
  96. while(o<dlugosc[l-2])
  97. {
  98. imiona[h]=imie[o];
  99. o++;
  100. h++;
  101. }
  102. imiona[h]=' ';
  103. h++;
  104. o=0;
  105. while(o<dlugosc[l-1])
  106. {
  107.  
  108. imiona[h]=nazwisko[o];
  109. o++;
  110. h++;
  111. }
  112. imiona[h]=' ';
  113. h++;
  114. }
  115. suma+=dlugosc[d++];
  116. suma+=dlugosc[d++];
  117. suma++;
  118. g2=n;
  119. //SORTOWANIE WYNIKOW:
  120. for(int f=0; f<n; f++)
  121. {
  122. for(int f2=1; f2<g2; f2++)
  123. {
  124. if(punkty[f2-1]<punkty[f2])
  125. {
  126.  
  127. //kolejnosc
  128. f4=kolejnosc[f2];
  129. kolejnosc[f2]=kolejnosc[f2-1];
  130. kolejnosc[f2-1]=f4;
  131. }
  132. }
  133. g2--;
  134. }
  135. //ZAOKRÄ„GLANIE
  136. double precision = 0.1;
  137. for(int j1=0; j1<n; j1++)
  138. {
  139.  
  140. punkty[j1]=round(punkty[j1]/precision)*precision;
  141. }
  142.  
  143. //WYPISYWANIE
  144. for(int h1=0; h1<n; h1++)
  145. {
  146. l4=0;
  147. l2=kolejnosc[h1]*2;
  148. l3=dlugosc[l2]+dlugosc[l2+1]+2;
  149. for(int h3=0; h3<l2; h3++)
  150. {
  151. l4+=dlugosc[h3]+1;
  152. }
  153.  
  154. for(int h2=l4; h2<l3+l4; h2++)
  155. {
  156. cout<<imiona[h2];
  157. }
  158. l2=kolejnosc[h1];
  159. cout<<punkty[l2]<<endl;
  160. }
  161.  
  162. }
  163.  
  164. cin.ignore();
  165. cin.get();
  166. return 0;
  167. }
  168.  
Success #stdin #stdout 0s 15240KB
stdin
1
3.5 4.6 120 10 2
PIOTR ZYLA 130.5 -2.5 11 17.5 17.0 16.5 17.0 18.0
STEFAN HULA 120.5 1.5 9 18.0 18.0 18.0 19.0 17.0
stdout
STEFAN HULA 124.8
PIOTR ZYLA 117