1.ASC
#include <iostream>
using namespace std;
int main()
{
cout<<'L'-'A'+65;
return 0;
}
2.排列数
#include <iostream>
using namespace std;
const int N=510;
int dp[N][N];
const int mod=123456;
int main(){
int n,k;
scanf("%d%d",&n,&k);
dp[1][1]=1;
dp[2][1]=2;
for(int i=3;i<=n;i++){
for(int j=1;j<i&&j<=k;j++){
dp[i][j]=(dp[i][j]+dp[i-1][j]*j)%mod;
dp[i][j]=(dp[i][j]+dp[i-1][j-1]*2)%mod;
if(j>1)dp[i][j]=(dp[i][j]+dp[i-1][j-2]*(i-j))%mod;
}
}
printf("%d",dp[n][k]);
return 0;
}
3.平面切分
#include <iostream>
#include <set>
using namespace std;
typedef pair<double,double>PDD;
set<PDD>lines;
int check(double a,double b){
set<PDD>points;
for(set<PDD>::iterator i=lines.begin();i!=lines.end();i++){
double ai=i->first,bi=i->second;
if(ai!=a){
double x=(bi-b)/(a-ai);
double y=a*x+b;
points.insert({x,y});
}
}
return points.size();
}
int main(){
int n;
scanf("%d",&n);
long long ans=1;
for(int i=1;i<=n;i++){
double a,b;
scanf("%lf%lf",&a,&b);
int t=lines.size();
lines.insert({a,b});
if(t!=lines.size()){
ans++;
ans+=check(a,b);
}
}
printf("%lld",ans);
return 0;
}
|