結果
問題 |
No.2426 Select Plus or Minus
|
ユーザー |
|
提出日時 | 2023-08-18 23:39:28 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 1,030 bytes |
コンパイル時間 | 1,486 ms |
コンパイル使用メモリ | 168,216 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-11-28 11:12:46 |
合計ジャッジ時間 | 3,585 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 WA * 1 |
other | AC * 35 WA * 6 |
ソースコード
#include <bits/stdc++.h> //#include <atcoder/all> using namespace std; //using namespace atcoder; #define rep(i,a,n) for (int i = a; i < (n); i++) #define all(x) (x).begin(),(x).end() using ll = long long; using P = pair<int,int>; using Graph = vector<vector<int>>; int mod = 998244353; int INF = 1001001001; using pll = pair<int,int>; int Flag=0; //デフォルトでNoがでる void yn(int Flag){ if(Flag==1){ cout<<"Yes"<<endl; } else if(Flag==0){ cout<<"No"<<endl; } else{ cout<<"Draw"<<endl; } } void cerrVec(vector<string> &V){ int n=V.size(); rep(i,0,n){ for(auto x:V[i]){ cerr<<x<<" "; } cerr<<endl; } cerr<<endl; } /* int H,W; cin>>H>>W; vector<vector<char>> C(H,vector<char> (W)); rep(i,0,H) rep(j,0,W) cin>>C[i][j]; */ int main(){ ll K; cin>>K; int cnt=0; string S; while(K!=1){ if(K%2){ K*=3; K++; S+="+"; } else{ K/=2; S+="/"; } cnt++; //cerr<<K<<endl; } cout<<cnt<<endl; cout<<S; }