Advertisement
Guest User

Untitled

a guest
Aug 18th, 2019
96
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.71 KB | None | 0 0
  1. #include <iostream>
  2. using namespace std;
  3. int main() {
  4. long long number,a,b,x;
  5. cin>>number;
  6. for(int i=0;i<number;i++){
  7. cin>>a>>b;
  8. if(a==0||b==0||a==1||b==1){
  9. if((a+b)%2==1)
  10. cout<<">//<"<<endl;//阿輝
  11. else
  12. cout<<">\\\\<"<<endl;//小莫
  13. }
  14. else if((a%2==0&&b%2==1)||(a%2==1&&b%2==0))//一奇一偶
  15. cout<<">//<"<<endl;
  16. else if(a%2==1&&b%2==1)//雙奇數
  17. cout<<">\\\\<"<<endl;
  18. else if(a==b)//已把奇數全部排除,同偶數
  19. cout<<">//<"<<endl;
  20. else {
  21. for(x=0;a!=b;x++){
  22. if(a>b)
  23. a-=b;
  24. else if(b>a)
  25. b-=a;
  26. }
  27. if(x%2==1)
  28. cout<<">\\\\"<<endl;
  29. else
  30. cout<<">//<"<<endl;
  31. }
  32. }
  33. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement