سلام
والا من داشتم برنامه مینوشتم ,, برنامم هم کاملا درسته از لحاظ اجرایی ولی تو نوع نمایش ارور میده تستر :|
اگه کسی میدونه چجوری درستش کنم یا ترجمه دقیقی از این متن میفهمه بهم بگه لظفا
مرسی
[ برای مشاهده لینک ، با نام کاربری خود وارد شوید یا ثبت نام کنید ]
[ برای مشاهده لینک ، با نام کاربری خود وارد شوید یا ثبت نام کنید ]
Input
Standard input will contain multiple test cases. The first line of the input is a single integer T (1 <= T <= 50) which is the number of test cases. T test cases follow, each preceded by a single blank line.
Each test case contains 4 lines for the coordinates of the four distinct vertices that are picked. Each line contains the x and y coordinates separated by a single space (0 < x, y < 1,000). But please notice that the coordinates are not necessarily given in either clockwise or counterclockwise order for a square.
Output
Results should be directed to standard output. Start each case with "Case #:" on a single line, where # is the case number starting from 1. Two consecutive cases should be separated by a single blank line. No blank line should be produced after the last test case.
The output should be either "Yes" or "No", indicating whether or not the four given positions can form a square.
اینم کد من ( البته قسمتای خروجیشو فقط چک کنید چون منظق برنامه درسته)
[PHP] #include <iostream>
#include <cmath>
using namespace std;
int main()
{
int n , j=1;
cin >> n;
while ( n-- )
{
cout << endl;
float x[2][4] , d[6] ;
int k=0 , i , l=0;
for (i=0 ; i<4 ; ++i)
cin >> x[0][i] >> x[1][i];
for (i=0 ; i<3 ; ++i)
for(int j=i+1 ; j<4 ; ++j)
d[k++] = pow(x[1][j]-x[1][i],2) + pow(x[0][j]-x[0][i],2) ;
k=1;
for (i=1 ; i<6 ; ++i)
if ( d[0]==d[i] )
k++;
else if( d[0]==2*d[i] || d[i]==2*d[0] )
l++;
cout << "Case " << j++ << ":\n";
cout <<( ((k==4 && l==2)||(k==2 && l==4)) ? "Yes\n" : "No\n" );
}
}//[/PHP]
البته اخرشو اینجوری هم امتحان کردم :|
[PHP] cout << "Case " << j++ << ":\n";
cout <<( ((k==4 && l==2)||(k==2 && l==4)) ? "Yes\n\n" : "No\n\n" ); [/PHP]