简单有趣#6:是无限的过程吗?【难度:1级】:
答案1:
namespace myjinxin
{
using System;
public class Kata
{
public bool IsInfiniteProcess ( int a, int b)
{
return a> b || a< b & amp; & amp; ( b- a) % 2 == 1 ;
}
}
}
答案2:
namespace myjinxin {
public class Kata {
public bool IsInfiniteProcess ( int a, int b ) {
if ( a > b ) {
return true ;
}
if ( a == b ) {
return false ;
}
return ( b - a ) % 2 != 0 ;
}
}
}
答案3:
namespace myjinxin
{
public class Kata
{
public bool IsInfiniteProcess ( int a, int b)
{
if ( b < a) { return true ; }
return ( a+ b) % 2 == 0 ? false : true ;
}
}
}
答案4:
namespace myjinxin
{
using System;
public class Kata
{
public bool IsInfiniteProcess ( int a, int b) {
if ( a > b ) return true ;
return ( b - a) % 2 != 0 ;
}
}
}
答案5:
namespace myjinxin
{
using System;
public class Kata
{
public bool IsInfiniteProcess ( int a, int b)
{
if ( a > b ) return true ;
return Math. Abs ( b - a) % 2 != 0 ;
}
}
}
答案6:
namespace myjinxin
{
using System;
public class Kata
{
public bool IsInfiniteProcess ( int a, int b) = > a> b || a% 2 != b% 2 ;
}
}
答案7:
namespace myjinxin
{
using System;
public class Kata
{
public bool IsInfiniteProcess ( int a, int b) = > ( a> b || ( b- a) % 2 != 0 ) ? true : false ;
}
}
答案8:
namespace myjinxin
{
using System;
public class Kata
{
public bool IsInfiniteProcess ( int a, int b) = > a > b || a% 2 + b% 2 == 1 ;
}
}
答案9:
namespace myjinxin
{
using System;
public class Kata
{
public bool IsInfiniteProcess ( int a, int b) = >
a > b || ( b - a) % 2 != 0 ;
}
}
答案10:
namespace myjinxin
{
using System;
public class Kata
{
public bool IsInfiniteProcess ( int a, int b) = > ! ( a <= b & amp; & amp; a % 2 == b % 2 ) ;
}
}