Algorithm with Problem Solving
#include <iostream> using namespace std; int main(){ int i, m, n, p, s=0; cin >> m >> n; for(p=1;p*p<m;++p); for(i=p;i*i<=n;++i) s+=i*i; if(s) cout<<s<<' '<<p*p; else cout<<-1; return 0; }
댓글 쓰기
댓글 없음:
댓글 쓰기