結果
問題 | No.2426 Select Plus or Minus |
ユーザー |
|
提出日時 | 2023-08-18 21:05:39 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 418 bytes |
コンパイル時間 | 1,301 ms |
コンパイル使用メモリ | 166,092 KB |
実行使用メモリ | 6,820 KB |
最終ジャッジ日時 | 2024-11-28 04:46:07 |
合計ジャッジ時間 | 3,586 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 WA * 1 |
other | AC * 35 WA * 6 |
ソースコード
#include <bits/stdc++.h> using namespace std; using ll = long long; int main(){ ios::sync_with_stdio(false); cin.tie(0); ll n; cin >> n; string ans; while(n != 1){ if(n & 1){ ans += "+"; n = 3 * n + 1; }else{ ans += "/"; n /= 2; } } //cerr << n << '\n'; cout << ans.size() << '\n'; cout << ans << '\n'; }