• Source
    1. #include <iostream>
    2. using namespace std;
    3.  
    4. int main ()
    5. {
    6. int t;
    7. cin>>t;
    8. int n;
    9. for (int i=1; i<=t; i++)
    10. {
    11. cin>>n;
    12. if (n==0) cout<<"0"<<endl;
    13. else if (n==1) cout<<"1"<<endl;
    14. else if (n==2) cout<<"4"<<endl;
    15. else if (n==3) cout<<"5"<<endl;
    16. else if (n%2==0) cout<<(n)*(n/2)<<endl;
    17. else cout<<(n/2+1)*(n/2+1)+(n/2)*(n/2)<<endl;
    18. }
    19. return 0;
    20. }