結果
| 問題 |
No.2708 Jewel holder
|
| コンテスト | |
| ユーザー |
nonon
|
| 提出日時 | 2024-03-31 13:56:10 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 2 ms / 2,000 ms |
| コード長 | 798 bytes |
| コンパイル時間 | 2,081 ms |
| コンパイル使用メモリ | 193,848 KB |
| 最終ジャッジ日時 | 2025-02-20 16:43:21 |
|
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 17 |
ソースコード
#include<bits/stdc++.h>
using namespace std;
int H,W;
char A[11][11];
long dp[11][11][202];
int main()
{
ios::sync_with_stdio(false);
cin.tie(nullptr);
cin>>H>>W;
for(int i=0;i<H;i++)for(int j=0;j<W;j++)cin>>A[i][j];
dp[0][0][1]=1;
for(int i=0;i<H;i++)for(int j=0;j<W;j++)
{
for(int k=0;k<=H*W;k++)
{
if(i)
{
if(A[i][j]=='o')dp[i][j][k+1]+=dp[i-1][j][k];
else if(A[i][j]=='x')dp[i][j][k]+=dp[i-1][j][k+1];
}
if(j)
{
if(A[i][j]=='o')dp[i][j][k+1]+=dp[i][j-1][k];
else if(A[i][j]=='x')dp[i][j][k]+=dp[i][j-1][k+1];
}
}
}
long ans=0;
for(int k=0;k<=H*W;k++)ans+=dp[H-1][W-1][k];
cout<<ans<<endl;
}
nonon