daily pastebin goal
28%
SHARE
TWEET

Untitled

a guest Mar 25th, 2019 69 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include <iostream>
  2. #include <fstream>
  3. #include <iomanip>
  4.  
  5. using namespace std;
  6. void skaityti();
  7. void rasyti();
  8. int max_(int d,int A[]);;
  9. int tsk,d,s,k;;
  10. int T[6],S1[25];
  11.  
  12.  
  13. int main()
  14. {
  15.     skaityti();
  16.     rasyti();
  17.     return 0;
  18. }
  19.  
  20. void skaityti()
  21. {
  22.     fstream in("U1.txt");
  23.     in >> tsk;
  24.     in >> d;
  25.     for (int i = 1; i <=d;i++)
  26.     {
  27.     for(int j =1; j<=tsk; j++)
  28.     {
  29.         in >> T[j];
  30.         s+=T[j];
  31.     }
  32.     S1[i]+=s;
  33.     s=0;
  34.     }
  35.  
  36. }
  37.  
  38. int max_(int d,int A[])
  39. {
  40.     int max_=A[1];
  41.     k = 0;
  42.     for(int i = 1; i<=d;i++)
  43.     {
  44.         if(A[i] >= max_)
  45.         {
  46.             k++;
  47.             max_ = A[i];
  48.         }
  49.     }
  50.     return max_;
  51. }
  52.  
  53. void rasyti()
  54. {
  55.     ofstream out("U1rez.txt");
  56.     cout << k << " " << max_(d,S1) << endl;
  57.  
  58. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top