project_Eular problem6:求1到100的和平方与平方和之差
long tmpA=0,tmpB=0;
for(int i=1; i<=100; i++){
tmpA += i*i;
tmpB +=i;
}
cout << tmpB*tmpB - tmpA <<endl;
long tmpA=0,tmpB=0;
for(int i=1; i<=100; i++){
tmpA += i*i;
tmpB +=i;
}
cout << tmpB*tmpB - tmpA <<endl;
暂无评论。
评论功能维护中,当前仅展示历史评论。