結果

問題 No.80 四角形を描こう
ユーザー ko_ki_leoko_ki_leo
提出日時 2015-10-12 08:47:00
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 365 ms / 5,000 ms
コード長 370 bytes
コンパイル時間 1,197 ms
コンパイル使用メモリ 157,860 KB
実行使用メモリ 485,916 KB
最終ジャッジ日時 2024-04-16 22:51:27
合計ジャッジ時間 5,821 ms
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 306 ms
485,740 KB
testcase_01 AC 302 ms
485,588 KB
testcase_02 AC 337 ms
485,608 KB
testcase_03 AC 306 ms
485,632 KB
testcase_04 AC 306 ms
485,656 KB
testcase_05 AC 305 ms
485,748 KB
testcase_06 AC 301 ms
485,748 KB
testcase_07 AC 300 ms
485,548 KB
testcase_08 AC 299 ms
485,728 KB
testcase_09 AC 302 ms
485,600 KB
testcase_10 AC 308 ms
485,760 KB
testcase_11 AC 365 ms
485,916 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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

int n;
int ans;
int memo[11111][11111];

void solve(int a, int b){

  if(a*2+b*2 > n) return;
  if(~memo[a][b]) return;
  ans = max(ans, a * b);  

  memo[a][b] = a * b;
  
  solve(a+1, b);
  solve(a, b+1);
  
  return;
}

int main(){

  cin >> n;

  memset(memo, -1, sizeof(memo));
  solve(0, 0);
  cout << ans << endl;

}
0