結果

問題 No.80 四角形を描こう
ユーザー motimoti
提出日時 2020-03-08 15:03:23
言語 C++17(clang)
(17.0.6 + boost 1.83.0)
結果
AC  
実行時間 2 ms / 5,000 ms
コード長 434 bytes
コンパイル時間 1,691 ms
コンパイル使用メモリ 134,400 KB
実行使用メモリ 4,380 KB
最終ジャッジ日時 2023-08-20 14:13:38
合計ジャッジ時間 2,430 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,380 KB
testcase_01 AC 1 ms
4,380 KB
testcase_02 AC 1 ms
4,376 KB
testcase_03 AC 2 ms
4,380 KB
testcase_04 AC 1 ms
4,380 KB
testcase_05 AC 1 ms
4,380 KB
testcase_06 AC 2 ms
4,380 KB
testcase_07 AC 2 ms
4,376 KB
testcase_08 AC 2 ms
4,376 KB
testcase_09 AC 1 ms
4,376 KB
testcase_10 AC 2 ms
4,380 KB
testcase_11 AC 2 ms
4,380 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp:11:20: warning: shifting a negative signed value is undefined [-Wshift-negative-value]
  long long mx = -1<<29;
                 ~~^
1 warning generated.

ソースコード

diff #

#include <bits/stdc++.h>

using namespace std;

#define REP(i,a,b) for(int i=a;i<(long long)b;i++)
#define rep(i,n) REP(i,0,n)

int main() {
  
  long long n; cin >> n;
  long long mx = -1<<29;
  bool ok = 0;
  REP(K, 1, n) {
    long long N = n;
    N -= 2*K;
    if(N < 0) { continue; }
    ok = 1;
    N /= 2;
    mx = max(mx, K*N);
  }
  
  if(ok) {
    cout << mx << endl;
  }
  else {
    cout << 0 << endl;
  }
  
  return 0;
}
0