QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#641440 | #49. Counting paths | test123 | 50 ✓ | 1ms | 3972kb | C++14 | 575b | 2024-10-14 20:31:06 | 2024-10-14 20:31:06 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
const int maxn=205;
const int mod=1000000007;
int read(){
int ret=0,f=1;char ch=getchar();
while(!isdigit(ch)){if(ch=='-')f=-f;ch=getchar();}
while( isdigit(ch)){ret=(ret<<3)+(ret<<1)+(ch&15);ch=getchar();}
return ret*f;
}
int n,m;
int f[maxn][maxn];
int main(){
n=read(),m=read();
f[0][1]=1;
for(int i=1;i<=n;++i){
for(int j=1;j<=m;++j){
char ch=getchar();
while(ch!='.'&&ch!='X') ch=getchar();
if(ch=='.') f[i][j]=(f[i-1][j]+f[i][j-1])%mod;
}
}
printf("%d\n",f[n][m]);
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Pretests
Final Tests
Test #1:
score: 5
Accepted
time: 0ms
memory: 3880kb
input:
3 4 .... ..X. ....
output:
4
result:
ok single line: '4'
Test #2:
score: 5
Accepted
time: 1ms
memory: 3972kb
input:
200 200 ...X..X.....X....XXX..X.X.X.X..X......X.X....X.......X........X.XX.X..X....XX..XXXXX.X.XXX..........XX..XXX.XX....X.......XX..X..X...X.XX..XXX.........XX......X...............XX...XX.XX.X...X...XX.XX. X..X....X.......XXX.XX.....X.XX..XX.X...X.X.XXX....XX...XX..X.X...X.....X.XX.X....X..XXX......
output:
0
result:
ok single line: '0'
Test #3:
score: 5
Accepted
time: 0ms
memory: 3800kb
input:
3 3 .X. X.. ...
output:
0
result:
ok single line: '0'
Test #4:
score: 5
Accepted
time: 0ms
memory: 3804kb
input:
5 5 ..... ..... ..... ..... .....
output:
70
result:
ok single line: '70'
Test #5:
score: 5
Accepted
time: 0ms
memory: 3804kb
input:
10 10 .......... .......... .....X.... .......... .......... ...X...... .......... X......... .......X.. ..........
output:
18238
result:
ok single line: '18238'
Test #6:
score: 5
Accepted
time: 0ms
memory: 3764kb
input:
30 20 .................... .................... .................... .................... .................... .................... .................... .................... ....X............... .................... .................... .................... .................... .................... ...
output:
833886024
result:
ok single line: '833886024'
Test #7:
score: 5
Accepted
time: 0ms
memory: 3804kb
input:
10 10 ....X..XX. .X.X.X.XX. .XX..XXXX. XX....XXX. XXXX.X.X.X .XX.XX...X .X.XX..X.. XXX....X.X ..XX.XXXX. X...X.....
output:
0
result:
ok single line: '0'
Test #8:
score: 5
Accepted
time: 0ms
memory: 3812kb
input:
100 100 ...X.....X..X...X..XX.....X.X.....X....X......X...XXX..X........XX....X......X......X.X..........XX. ...X.X.X............XXX....X..............X....X....X.X..XX....X.......X...........................X ...XX..............X......X.....X................X.X..XX...X.X..X......XXX.X.....X.X.........
output:
364708889
result:
ok single line: '364708889'
Test #9:
score: 5
Accepted
time: 0ms
memory: 3836kb
input:
100 100 .........X................................................................X..XXX...X................ ..............X............X......................X...................X............X........X....... X..................X..................X...........X......X..........XX...X...................
output:
708504086
result:
ok single line: '708504086'
Test #10:
score: 5
Accepted
time: 1ms
memory: 3968kb
input:
200 200 .....X......X.XX..X.X..X.....X....X.......X.X.............X.X........X.X..........X.X.X.....X........XXXX.....XX..X.......X....XXX.X..X........X..X..X.....X...XX......X.X....................X......... XX.XX.......X..XXX........XX...............X......X........X.X.......X........X.X.....X.......
output:
0
result:
ok single line: '0'