2 条题解

  • 1
    @ 2023-10-17 17:36:33

    #include<bits/stdc++.h>

    using namespace std;

    queue<string> q; int n,m,t; bool l; int u(int t) { int ture=1; for(int i=1;i<m;i++) { q.push(q.front()); q.pop(); } while(q.size()>1) { if(t%77) { l=ture; } int sl=t; while(sl!=0) { if(sl%107) { l=ture; } sl/=10; } if(l==1) { q.pop(); } else { q.push(q.front()); q.pop(); } t++; } } int main () { cin>>n>>m>>t; for(int i=-1;i<=n;i++) { string o; cin>>o; q.push(o); } u(t); cout<<q.front()<<endl; return 0; }

    • -3
      @ 2025-1-15 14:26:13
      #include <iostream>
      #include <queue>
      using namespace std;
      int main() {
          int n, m;
      	cin >> n >> m;
          queue<int> q;
          for (int i = 1; i <= n; i ++) {
              q.push(i);
          }
          int cur = 1;
          while (q.size() > 1) {
              int x = q.front();
              q.pop();
              if (cur == m) {
                  cur = 1;
              } else {
                  q.push(x);
                  cur++;
              }
          }
          cout << q.front() << endl;
          return 0;
      }
      
      • 1

      信息

      ID
      137
      时间
      1000ms
      内存
      256MiB
      难度
      8
      标签
      (无)
      递交数
      213
      已通过
      36
      上传者