Sergey101

Q1

Jan 30th, 2025
63
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.25 KB | None | 0 0
  1. #include <bits/stdc++.h>
  2. typedef int_fast64_t lli;
  3. typedef long double ld;
  4. using namespace std;
  5.  
  6. int main()
  7. {
  8.     ios_base::sync_with_stdio(false);
  9.     cin.tie(nullptr);
  10.     cout.tie(nullptr);
  11.  
  12.     lli n, correct = 0;
  13.     cin >> n;
  14.     for(lli i = 0; i < n; i++)
  15.     {
  16.         lli a, b, c;
  17.         char op, e;
  18.         cin >> a >> op;
  19.         if(op == '/')
  20.         {
  21.             cin >> op;
  22.         }
  23.         cin >> b >> e >> c;
  24.         switch(op)
  25.         {
  26.             case '+':
  27.                 correct += (a+b == c);
  28.                 break;
  29.             case '-':
  30.                 correct += (a-b == c);
  31.                 break;
  32.             case '*':
  33.                 correct += (a*b == c);
  34.                 break;
  35.             case '/':
  36.                 correct += (b == 0 ? 0 : a/b == c);
  37.                 break;
  38.         }
  39.     }
  40.  
  41.     if(100*correct >= 70*n)
  42.     {
  43.         cout << "A\n";
  44.     }
  45.     else if(100*correct >= 60*n)
  46.     {
  47.         cout << "B\n";
  48.     }
  49.     else if(100*correct >= 50*n)
  50.     {
  51.         cout << "C\n";
  52.     }
  53.     else if(100*correct >= 40*n)
  54.     {
  55.         cout << "D\n";
  56.     }
  57.     else if(100*correct >= 30*n)
  58.     {
  59.         cout << "E\n";
  60.     }
  61.     else
  62.     {
  63.         cout << "F\n";
  64.     }
  65.     return 0;
  66. }
Advertisement
Add Comment
Please, Sign In to add comment