Advertisement
AlexAvram

Untitled

Jun 5th, 2025
143
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.62 KB | None | 0 0
  1. //#1860 BlackFriday
  2. #include <fstream>
  3.  
  4. using namespace std;
  5.  
  6. ifstream fin("blackfriday.in");
  7. ofstream fout("blackfriday.out");
  8.  
  9. int main()
  10. {
  11.  
  12.     int n, pret1[11], pret2[11];
  13.     fin>>n;
  14.     for (int i=1; i<=n; ++i)
  15.         fin>>pret1[i];
  16.     for (int i=1; i<=n; ++i)
  17.         fin>>pret2[i];
  18.     int dif, indice;
  19.     double procent, procent_max=-1;
  20.     for (int i=1; i<=n; ++i)
  21.     {
  22.         dif=pret1[i]-pret2[i];
  23.         procent=(dif*100)/pret1[i];
  24.         if (procent>procent_max)
  25.         {
  26.             procent_max=procent;
  27.             indice=i;
  28.         }
  29.     }
  30.     fout<<indice;
  31.     return 0;
  32. }
  33.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement