結果

問題 No.2426 Select Plus or Minus
ユーザー ochiaigawa
提出日時 2023-08-18 21:05:59
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 338 bytes
コンパイル時間 1,707 ms
コンパイル使用メモリ 192,656 KB
最終ジャッジ日時 2025-02-16 09:14:25
ジャッジサーバーID
(参考情報)
judge2 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2 WA * 1
other AC * 35 WA * 6
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
int main() {
  cin.tie(0); cout.tie(0);
  long long N;
  cin >> N;
  string ans = "";
  while(N > 1) {
    if(N % 2 == 0) {
      N /= 2;
      ans += '/';
    } else {
      N = 3 * N + 1;
      ans += '+';
    }
  }
  cout << (int) ans.length() << '\n';
  cout << ans << '\n';
  return 0;
}
0