if()
else if()
else
有的时候会莫名其妙进前一条if?
#include<bits/stdc++.h>
using namespace std;
int main()
{
long long c,n,x,a,b;
cin>>c>>n;
x=n/c;
if(x>=2)
{
b=x*c;
a=(x-1)*c;
cout<<a*b<<endl;
}
else if(x=1)
cout<<c*c<<endl;
else
cout<<-1<<endl;
return 0;
}输入:100 1
输出:10000



京公网安备 11010502036488号