若遇到上述情況,直接換行即可
公式:n*(n+1)*(2*n+1)/6
C++程式碼:
#include<iostream>
using namespace std;
int main(){
int n;
while(cin>>n) {
if(n!=0) cout<<n*(n+1)*(2*n+1)/6<<endl;
else cout<<endl;
}
}
bro you can't just send the answer that's breaking rules (nvm d't ask wdym)
What's nvm d't ask wdym mean?
nvm=never mind wdym= what do you mean