水题,关键格式问题,每行数据换行,但是题目又没有要求最后一行不换行,所以别想多了。
#include <iostream> using namespace std; int main(){ int T,t,i,j; int a,b,c; cin>>T; for(i = 1;i<=T;i++){ cin>>a>>b>>c; t = 0; if(a>b){ t=a;a=b;b=t;} if(b>c){ t=c;c=b;b=t;} if(a>b){ t=a;a=b;b=t;} cout<<"Scenario #"<<i<<":"<<endl; if(a*a+b*b==c*c) cout<<"yes"<<endl; else cout<<"no"<<endl; cout<<endl; } }