fork download
  1. # include <bits/stdc++.h>
  2. using namespace std ;
  3.  
  4. # define ll long long
  5. # define fs first
  6. # define sc second
  7. # define pll pair<long, long>
  8. # define pii pair<int, int>
  9.  
  10. int main() {
  11. ll int n, s ;
  12. cin >> n ;
  13. while ( n-- ) {
  14. cin >> s ;
  15. cout << pow(s+1, 2) - 1 << "\n" ; // 計算後的公式,記得分子分母同乘( a^2 - b^2 = (a - b)(a + b) )
  16. }
  17. return 0 ;
  18. }
  19.  
Success #stdin #stdout 0s 5284KB
stdin
Standard input is empty
stdout
Standard output is empty