結果

問題 No.1992 Tendon Walk
ユーザー LV3zJigVW57oPGy
提出日時 2022-07-18 18:44:15
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 348 bytes
コンパイル時間 1,214 ms
コンパイル使用メモリ 157,212 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-06-30 18:45:49
合計ジャッジ時間 1,791 ms
ジャッジサーバーID
(参考情報)
judge1 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 6
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:18:13: warning: ‘b’ may be used uninitialized in this function [-Wmaybe-uninitialized]
   18 |     cout << b;
      |             ^

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;


int main() {
int a;
cin >> a;
int b;
  if (a>4)
  {
   a = a - 4;
    if (a % 2 == 0) {
   b = (a / 2) * 10 + 4;
    }
     else if(a % 2 == 1) 
     {b = ((a + 1)/2)* 10 +4 +1;
     }
    cout << b;
  }
   else if (a <= 4)
   { b = (a / 2) * 2;
    if (a % 2 == 1)
    {b +=3;}
    cout << b;
   }
}
0