#12993: c++解答 闇羽


22505031 (今晚打老虎)

學校 : 國立嘉義高級中學
編號 : 68291
來源 : [140.114.208.97]
最後登入時間 :
2022-03-27 20:03:18
a059. 完全平方和 | From: [163.27.3.90] | 發表日期 : 2017-11-16 12:02

#include <iostream>
using namespace std;
/* run this program using the console pauser or add your own getch, system("pause") or input loop */

int main()
{
      int T,totle;
      cin>>T;
      totle=T;
      while(T--)
    {   int n,m,sun=0;
          cin>>n>>m;
       for(int i=n;i<=m;i++)
      {
        for(int k=0;k<=m;k++)
        {
            if(k*k==i)
            sun+=i;
        }

      }
       cout<<"Case "<<totle-T<<": "<<sun<<endl;

    }



     return 0;
}

 
ZeroJudge Forum