#11377: WA INPUT OUTPUT全對為什麼出來是錯的...


cas3003p (unknown)


#include <iostream>
#include <cstdlib>
using namespace std;

int main(void)
{
int s, d, n;

cin >> n;
for (int i = 0; i < n; i++)
{
cin >> s >> d;

if (s>d && (s+d)%2==0 && (s-d)%2==0)

cout << (s+d)/2 << " " << (s-d)/2<< endl;
else

cout << "impossible"<<endl;
}

system("Pause");
return 0;

}

#11379: Re:WA INPUT OUTPUT全對為什麼出來是錯的...


a2583669 (YuFong)


#include
#include
using namespace std;

int main(void)
{
int s, d, n;

cin >> n;
for (int i = 0; i < n; i++)
{
cin >> s >> d;

if (s>d && (s+d)%2==0 && (s-d)%2==0)

cout << (s+d)/2 << " " << (s-d)/2<< endl;
else

cout << "impossible"<<endl;
}

system("Pause");
return 0;

}



輸入有用while嗎   讓他一直丟測資  有時候會  WA輸出段少