結果

問題 No.1764 Square
ユーザー Kome_soudouKome_soudou
提出日時 2021-11-27 18:19:47
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 915 bytes
コンパイル時間 1,782 ms
コンパイル使用メモリ 170,348 KB
実行使用メモリ 4,384 KB
最終ジャッジ日時 2023-09-12 21:42:04
合計ジャッジ時間 2,300 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,384 KB
testcase_01 AC 2 ms
4,380 KB
testcase_02 AC 1 ms
4,380 KB
testcase_03 AC 2 ms
4,380 KB
testcase_04 AC 1 ms
4,380 KB
testcase_05 AC 1 ms
4,380 KB
testcase_06 AC 2 ms
4,380 KB
testcase_07 AC 1 ms
4,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;

int main()
{
  int K;
  cin >> K;

  queue<char> q0;
  queue<char> q1;
  queue<char> q2;
  queue<char> q3;
  q0.push('A');
  q0.push('E');
  q1.push('B');
  q2.push('C');
  q3.push('D');
  for(int i = 0; i < K; i++)
  {
    if(i % 4 == 0)
    {
      q1.push(q0.front());
      q0.pop();
    }
    else if(i % 4 == 1)
    {
      q2.push(q1.front());
      q1.pop();
    }
    else if(i % 4 == 2)
    {
      q3.push(q2.front());
      q2.pop();
    }
    else
    {
      q0.push(q3.front());
      q3.pop();
    }
  }
  
  while(!q0.empty())
  {
    cout << q0.front();
    q0.pop();
  }
  cout << endl;
  while(!q1.empty())
  {
    cout << q1.front();
    q1.pop();
  }
  cout << endl;
  while(!q2.empty())
  {
    cout << q2.front();
    q2.pop();
  }
  cout << endl;
  while(!q3.empty())
  {
    cout << q3.front();
    q3.pop();
  }
  cout << endl;
  return 0;
}
0