Run ID | 作者 | 问题 | 语言 | 测评结果 | 分数 | 时间 | 内存 | 代码长度 | 提交时间 |
---|---|---|---|---|---|---|---|---|---|
135418 | 陈家宝 | 密钥 | C++ | 通过 | 100 | 215 MS | 1076 KB | 763 | 2024-03-05 16:16:42 |
#include<bits/stdc++.h> using namespace std ; queue<int> nums ; int mx ( queue <int> x ) { int mxn = -114514 ; while ( ! x . empty ( ) ){ mxn = max ( mxn , x . front ( ) ) ; x . pop ( ) ; } return mxn ; } string i2s ( int x ) { string ans = "" ; bool flg = false ; if ( x < 0 ){ flg = true ; x *= -1 ; } while ( x != 0 ){ ans = char ( ( x % 10 ) + '0' ) + ans ; x /= 10 ; } if ( flg )ans = "-" + ans ; return ans ; } int main ( ) { int n , m ; string ans = "" ; cin >> n >> m ; for ( int i = 1 ; i <= n ; i ++ ){ int x ; cin >> x ; if ( i > m ){ ans += i2s ( mx ( nums ) ) ; nums . pop ( ) ; } nums . push ( x ) ; } ans += i2s ( mx ( nums ) ) ; cout << ans; return 0 ; }