#include<iostream>
using namespace std;
int main()
{
int t,n;
cin>>t;
for(int e=0,a,b;e<t;e++)
{
cin>>n;
for(int f=1;f<=n;f++)
{
a=f*(n-(2*(f-1)));
b=(f+1)*(n-(2*f));
if(a>b)
{
break;
}
}
cout<<a<<endl;
}
return 0;
}
#include<iostream>
using namespace std;
int main()
{
int t,n,a,b;
cin>>t;
while(t--) //競賽超強寫法!
{
cin>>n;
for(int f=1;f<=n;f++)
{
a=f*(n-(2*(f-1)));
b=(f+1)*(n-(2*f));
if(a>b)
{
break;
}
}
cout<<a<<endl;
}
return 0;
}
Sylveon 發表於 2014-10-26 21:37
滿正常的阿
線上執行範測是對的
2
4
1 0
2
4
10
歡迎光臨 竹園論壇 (http://forum.tfcis.org/) | Powered by Discuz! X3.2 |