結果

問題 No.1992 Tendon Walk
ユーザー akinyan
提出日時 2022-07-14 20:22:56
言語 C++23
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 1,141 bytes
コンパイル時間 2,843 ms
コンパイル使用メモリ 244,036 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-06-26 04:45:15
合計ジャッジ時間 3,760 ms
ジャッジサーバーID
(参考情報)
judge4 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 6
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
using ch = char;
using ll = long long;
using ld = long double;
using db = double;
using st = string;
using vdb = vector<db>;
using vvdb = vector<vdb>;
using vl = vector<ll>;
using vvl = vector<vl>;
using vd = vector<ld>;
using vvd = vector<vd>;
using vs = vector<st>;
using vvs = vector<vs>;
using vc = vector<ch>;
using vvc = vector<vc>;
using vb = vector<bool>;
using vvb = vector<vb>;
const ll mod1 = 998244353;
const ll mod2 = 1000000007;

int main(){
  ll N;
  cin>>N;
  ll a=0;
  ll ans=0;
  for(int i=0; i<100; i++){
    a+=2;
    ans+=2;
    if(a==N){
      cout<<ans<<endl;
      return 0; 
    }
    a+=2;
    ans+=2;
    if(a==N){
      cout<<ans<<endl;
      return 0; 
    }
    a--;
    ans++;
    if(a==N){
      cout<<ans<<endl;
      return 0; 
    }
    a--;
    ans++;
    if(a==N){
      cout<<ans<<endl;
      return 0; 
    }
    a+=2;
    ans+=2;
    if(a==N){
      cout<<ans<<endl;
      return 0; 
    }
    a--;
    ans++;
    if(a==N){
      cout<<ans<<endl;
      return 0; 
    }
    a--;
    ans++;
    if(a==N){
      cout<<ans<<endl;
      return 0; 
    }
  }
}
0