View Code of Problem 18

#include<cstdio>
#include<iostream>
#include<algorithm>
#include<cmath>
#include<cstring>
#include<vector>
#include<map>
#include<string>
#include<set>
using namespace std;
int a[1000];
int main(){
    int n;
    while(cin>>n)
    {
        int t=n/2;
        if(n<3)printf("0\n");
        else if(n%2==0)
            printf("%d\n",(t-1)*t);
        else printf("%d\n",(t-1)*t/2+(t+1)*t/2);
    }
    return 0;
}
/*
1 2 4 6 9
*/

Double click to view unformatted code.


Back to problem 18