problemscpp
A collection of my answers to algorithm problems in c++.
静态 Public 成员函数 | 所有成员列表
leetcode::reaching_points::Solution类 参考

#include <leetcode.h>

静态 Public 成员函数

static bool reachingPoints (int sx, int sy, int tx, int ty)
 

详细描述

在文件 leetcode.h2165 行定义.

成员函数说明

◆ reachingPoints()

bool leetcode::reaching_points::Solution::reachingPoints ( int  sx,
int  sy,
int  tx,
int  ty 
)
static

在文件 leetcode.cpp5823 行定义.

5823 {
5824 while(tx > sx && ty > sy && tx != ty) {
5825 if(tx > ty) {
5826 tx %= ty;
5827 } else {
5828 ty %= tx;
5829 }
5830 }
5831 if(tx == sx && ty == sy) {
5832 return true;
5833 }
5834 if(tx == sx) {
5835 return ty > sy && (ty - sy) % tx == 0;
5836 }
5837 if(ty == sy) {
5838 return tx > sx && (tx - sx) % ty == 0;
5839 }
5840 return false;
5841 }

被这些函数引用 leetcode::reaching_points::TEST().


该类的文档由以下文件生成: