View Code of Problem 18

#include<iostream>
#include<stdio.h>
#include<bits/stdc++.h>
#include<algorithm>
#include<cmath>
#include<cstring>
#include<cstdlib>
using namespace std;
int main(){
    ios::sync_with_stdio(0);
	cin.tie(0);cout.tie(0);
    int times;
    while(cin>>times){
           int cnt=times/2-1;
           int temp=cnt*(cnt+1);
           if(times%2==1)
            temp+=cnt+1;
           cout<<temp;
    }
return 0;
}

Double click to view unformatted code.


Back to problem 18