提交时间:2024-04-06 16:48:56
运行 ID: 142131
# include <bits/stdc++.h> using namespace std ; queue <int> q ; int main ( ) { int n , m ; cin >> m >> n ; for ( int i = 1 ; i <= n ; i ++ ) { q . push ( i ) ; } for ( int i = 1 ; i < n ; i ++ ) { for ( int j = 1 ; j < m ; j ++ ) { int x = q . front ( ) ; q . pop ( ) ; q . push ( x ) ; } cout << q . front ( ) << ' ' ; q . pop ( ) ; } cout << q . front ( ) << endl ; return 0 ; }