暴力枚举
1 #include <iostream>
#include <vector>
#include <string> using namespace std; class FoxAndClassroom{
public:
string ableTo(int n , int m){
for(int i = ; i < n ; ++ i ){
for(int j = ; j < m; ++ j ){
vector<vector<bool> > visitFlag(n,vector<bool>(m,false));
int kx = i ,ky = j,count = ;
while(!visitFlag[kx][ky]){
visitFlag[kx][ky] = true;
kx = (kx+)%n;
ky = (ky+)%m;
count++;
}
if(count == m*n) return "Possible";
}
}
return "Impossible";
} };
相关文章
- 09-05Topcoder SRM 598 div2
- 09-05topcoder SRM 610 DIV2 TheMatrix
- 09-05Topcoder SRM 583 DIV2 SwappingDigits
- 09-05topcoder SRM 619 DIV2 GoodCompanyDivTwo
- 09-05topcoder srm607 div2
- 09-05topcoder srm606 div2
- 09-05TopCoder SRM 606 Div2 题解
- 09-05TopCoder SRM 144 DIV2(200-point)
- 09-05TopCoder SRM 144 DIV2(550-point)
- 09-05topcoder SRM 618 DIV2 WritingWords