結果
| 問題 |
No.2426 Select Plus or Minus
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2023-08-18 21:20:55 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 460 bytes |
| コンパイル時間 | 1,958 ms |
| コンパイル使用メモリ | 192,380 KB |
| 最終ジャッジ日時 | 2025-02-16 09:31:02 |
|
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 WA * 1 |
| other | AC * 35 WA * 6 |
ソースコード
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < n; ++i)
typedef long long ll;
using namespace std;
int main() {
cin.tie(0)->sync_with_stdio(0);
ll N;
cin >> N;
string ans = "";
while (N != 1) {
if (N % 2 == 0) {
N /= 2;
ans += "/";
} else {
N = N * 3 + 1;
ans += "+";
}
}
cout << ans.size() << "\n";
cout << ans << "\n";
return 0;
}