Advertisement
sherry_ahmos

Untitled

Nov 23rd, 2022
186
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.72 KB | None | 0 0
  1. #include <iostream>
  2. #include <iomanip>
  3. #include <bits/stdc++.h>
  4. using namespace std;
  5.  
  6. typedef long long ll;
  7. #define nl endl
  8. #define cy cout << "YES\n"
  9. #define cn cout << "NO\n"
  10. #define sz s.size()
  11. #define allv v.begin(), v.end()
  12. void sherry()
  13. {
  14.     ios_base::sync_with_stdio(false), cin.tie(nullptr), cout.tie(nullptr);
  15. #ifndef ONLINE_JUDGE
  16.     freopen("input.txt", "r", stdin), freopen("output.txt", "w", stdout);
  17. #endif
  18. }
  19.  
  20. void solve()
  21. {
  22.     ll n;
  23.     cin >> n;
  24.     if(n%2){
  25.         cout << (n/2*(n/2))+((n-n/2)*(n-n/2)) <<nl;
  26.     }else{
  27.         cout << n *(n / 2)<<nl;
  28.     }
  29. }
  30. int main()
  31. {
  32.     sherry();
  33.     ll t = 1;
  34.     cin >> t;
  35.     while (t--)
  36.     {
  37.         solve();
  38.     }
  39.     return 0;
  40. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement