I tried more times to get AC from https://www.spoj.com/problems/LOCKER/ this problem, what is wrong in my idea? Please clarify…
Here is my code:
#include <bits/stdc++.h>
typedef long long ll;
using namespace std;
const ll EPS=1e9+7;
int main()
{
ll t,n;
cin>>t;
while(t–)
{
cin>>n;
ll res;
if(n&1)
res=(((n/2)%EPS)((n/2+1)%EPS))%EPS;
else
res=(((n/2)%EPS)((n/2)%EPS))%EPS;
if(n<4 && n>0)res=n%EPS;
cout<<res<<endl;
}
return 0;
}