link
Problems
Solution
A
#include<set>
#include<map>
#include<ctime>
#include<queue>
#include<stack>
#include<vector>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<iostream>
#include<algorithm>
#define rint register int
typedef long long LL;
typedef unsigned long long ULL;
using namespace std;
int T,n;
int main()
{
// freopen("1.in","r",stdin);
scanf("%d",&T);
while(T--) {
scanf("%d",&n);
for(int i=1;i<=n;i++)
printf("%d ",i);
printf("
");
}
return 0;
}
B
#include<set>
#include<map>
#include<ctime>
#include<queue>
#include<stack>
#include<vector>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<iostream>
#include<algorithm>
#define rint register int
typedef long long LL;
typedef unsigned long long ULL;
using namespace std;
const int N=256;
int T,n,m;
char a[N][N];
int main()
{
// freopen("1.in","r",stdin);
int i;
scanf("%d",&T);
while(T--) {
scanf("%d%d",&n,&m);
int ans=0;
for(i=1;i<=n;i++)
scanf("%s",a[i]+1);
for(i=1;i<=n;i++)
ans+=(a[i][m]=='R');
for(i=1;i<=m;i++)
ans+=(a[n][i]=='D');
cout<<ans<<endl;
}
return 0;
}
C
#include<set>
#include<map>
#include<ctime>
#include<queue>
#include<stack>
#include<vector>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<iostream>
#include<algorithm>
#define rint register int
typedef long long ULL;
using namespace std;
const ULL MOD=1e9+7;
ULL n;
ULL p=1,k=1;
int main()
{
scanf("%lld",&n);
for(ULL i=1;i<=n;i++)
p=p*i%MOD;
for(ULL i=1;i<=n-1;i++)
k=k*2%MOD;
printf("%lld",((p-k)%MOD+MOD)%MOD);
return 0;
}