搜索结果
找到约 3 项符合
toj 的查询结果
C/C++语言编程 toj 4022源代码
#include <iostream>
using namespace std;
int main(){
int t;
cin>>t;
while(t--){
long long n;
cin>>n;
if(n%2==1)
cout<<(n*n-1)/4<<endl;
else if (n%4==0)
cout <<(n*n)/4-1<<endl;
else{
if(n==2)
cout<<1<<endl;
else{
long long k=n/2-1;
cout <<k*k+2*k-3<<endl;
}
...
数值算法/人工智能 一道经典的矩形切割的题目的解答
一道经典的矩形切割的题目的解答,原题见http://acm.tju.edu.cn/toj/vcontest/showp1835_A.html