我要玩原神
点我看鬼畜化学实验室
地堡求生
#include<iostream>
#include<cmath>
#include<algorithm>
#include<list>
#include<cstring>
#include<string>
#include<vector>
#include<queue>
#include<deque>
#include<stack>
#include<map>
#include<set>
#include<ctime>
using namespace std;
typedef long long ll;
#define int long long
char a[1010][1010];
string s;
bool check(int i,int j){
if(a[i][j]=='#'){
return 0;
}
for(int k=0;k<s.size();k++){
if(s[k]=='L'){
j--;
if(a[i][j]=='#'){
return 0;
}
}else if(s[k]=='R'){
j++;
if(a[i][j]=='#'){
return 0;
}
}else if(s[k]=='U'){
i--;
if(a[i][j]=='#'){
return 0;
}
}else if(s[k]=='D'){
i++;
if(a[i][j]=='#'){
return 0;
}
}
}
return 1;
}
signed main(){
int n,m,q;
cin>>n>>m>>q;
cin>>s;
for(int i=1;i<=n;i++){
for(int j=1;j<=m;j++){
cin>>a[i][j];
}
}
int ans=0;
for(int i=1;i<=n;i++){
for(int j=1;j<=m;j++){
if(check(i,j)){
ans++;
}
}
}
cout<<ans<<"\n";
return 0;
}
门外的树
#include<iostream>
#include<cmath>
#include<algorithm>
#include<list>
#include<cstring>
#include<string>
#include<vector>
#include<queue>
#include<deque>
#include<stack>
#include<map>
#include<set>
#include<ctime>
using namespace std;
typedef long long ll;
int main(){
ll n,m,l,r;
cin>>n>>m>>l>>r;
l-=n,r-=n;
ll kkk=(abs(l))/m;
ll luo=abs(r)/m;
if(r<0){
if(abs(r)%m==0){
cout<<kkk-luo+1;
}else{
cout<<kkk-luo;
}
}else if(l>0){
if(l%m==0){
cout<<luo-kkk+1;
}else{
cout<<luo-kkk;
}
}else{
cout<<kkk+luo+1;
}
return 0;
}