#35576: c++


qqazwwsxeedcrrfvttgb@gmail.com (Jackis666)

學校 : 嘉義市私立輔仁高級中學
編號 : 226198
來源 : [42.73.47.160]
最後登入時間 :
2023-07-22 13:59:09
a059. 完全平方和 | From: [163.27.10.252] | 發表日期 : 2023-06-07 11:38

#include "bits/stdc++.h"
using namespace std;
int main(){
    int n;
    cin>>n;
    for(int i=0;i<n;i++){
        int a,b;
        cin>>a>>b;
        int sum=0;
        for(int j=0;j<32;j++){
            if(a<=j*j and j*j<=b)
                sum+=j*j;
        }
        cout<<"Case "<<i+1<<": "<<sum<<endl;
    }
}

 
ZeroJudge Forum