結果
| 問題 |
No.1106 🦉 何事もバランスが大事
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2020-07-04 22:59:51 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 2 ms / 2,000 ms |
| コード長 | 510 bytes |
| コンパイル時間 | 547 ms |
| コンパイル使用メモリ | 66,504 KB |
| 実行使用メモリ | 6,948 KB |
| 最終ジャッジ日時 | 2024-09-19 14:56:33 |
| 合計ジャッジ時間 | 2,887 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 5 |
| other | AC * 77 |
コンパイルメッセージ
main.cpp:7:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
7 | main()
| ^~~~
ソースコード
#include<iostream>
using namespace std;
long N_;
int N[30];
long dp[31][2][2][120];
const int off=60;
main()
{
cin>>N_;
for(int i=0;i<30;i++)
{
int t=N_%5;
if(t>=3)t=t-5;
N[i]=t;
N_-=t;
N_/=5;
}
dp[30][0][0][off]=1;
for(int i=30;i--;)for(int j=0;j<2;j++)for(int k=0;k<2;k++)
{
int D=k?-2:0,U=j?2:N[i];
for(int l=0;l<120;l++)if(dp[i+1][j][k][l])
{
for(int x=D;x<=U;x++)
{
dp[i][j||x<U][k||x][l+x]+=dp[i+1][j][k][l];
}
}
}
cout<<dp[0][0][1][off]+dp[0][1][1][off]<<endl;
}