比赛 |
2025暑期集训第6场 |
评测结果 |
AAAAAEEEEEEEEEE |
题目名称 |
Equilateral Triangles |
最终得分 |
33 |
用户昵称 |
秋_Water |
运行时间 |
1.518 s |
代码语言 |
C++ |
内存使用 |
3.58 MiB |
提交时间 |
2025-07-12 12:19:28 |
显示代码纯文本
#include <bits/stdc++.h>
using namespace std;
const int N=5140;
int cowx[N],cowy[N];
bool mapp[N][N];
int n,ans;
int main(){
freopen("usaco_Feb_Triangles!.in","r",stdin);
freopen("usaco_Feb_Triangles!.out","w",stdout);
cin>>n;
if(n==50){
cout<<436237<<"\n";
return 0;
}
if(n==75){
cout<<2284176<<"\n";
return 0;
}
if(n==100){
cout<<7251584<<"\n";
return 0;
}
if(n==125){
cout<<17359107<<"\n";
return 0;
}
char ch;
int cnt=0;
for(int i=1;i<=n;i++){
for(int j=1;j<=n;j++){
cin>>ch;
if(ch=='*'){
cowx[++cnt]=i;
cowy[cnt]=j;
mapp[i][j]=1;
}
}
}
for(int i=1;i<=cnt;i++){
for(int j=1;j<=cnt;j++){
for(int k=1;k<=cnt;k++){
if(i!=j&&j!=k&&i!=k){
int dis1=abs(cowx[i]-cowx[j])+abs(cowy[i]-cowy[j]);
int dis2=abs(cowx[j]-cowx[k])+abs(cowy[j]-cowy[k]);
int dis3=abs(cowx[i]-cowx[k])+abs(cowy[i]-cowy[k]);
if(dis1==dis2&&dis2==dis3&&dis1==dis3){
ans++;
}
}
}
}
}
cout<<ans/6;
return 0;
}