求助
查看原帖
求助
561285
syq2011楼主2022/11/13 12:01
#include <iostream>
  
using namespace std;

int main()
{
  
    int n, m;
    cin >> n >> m;
    bool ans[100];
    int count = 1;
    int p = 1;
    for (int i = 0; i < n * m * 15; i++)
    {
        if (count > n)
        {
            count = 1;
        }
        if (p % m == 0 && !ans[count])
        {
            cout << count << " ";
        }
        if (!ans[count])
        {
            p++;
        }
        if ((p - 1) % m == 0 &&!ans[count])
        {
            ans[count] = true;
        }
        count++;
    }
    return 0;
}
2022/11/13 12:01
加载中...