| Run ID | Author | Problem | Lang | Verdict | Score | Time | Memory | Code Length | Submit Time |
|---|---|---|---|---|---|---|---|---|---|
| 159751 | 梁乃元 | 猴子选大王 | C++ | Accepted | 100 | 21 MS | 4392 KB | 522 | 2024-07-30 22:26:01 |
# include <bits/stdc++.h> using namespace std ; queue <int> q ; int main ( ) { int n , m ; cin >> n >> m ; for ( int i = 1 ; i <= n ; i ++ ) { q . push ( i ) ; } if ( n == 1 ) { cout << q . front ( ) << endl ; return 0 ; } while ( ! q . empty ( ) ) { if ( q . size ( ) == 1 ) { cout << q . front ( ) << endl ; return 0 ; } for ( int j = 1 ; j < m ; j ++ ) { int x = q . front ( ) ; q . pop ( ) ; q . push ( x ) ; } q . pop ( ) ; } return 0 ; }