1 条题解
-
0
C++ :
#include <bits/stdc++.h> #define int long long #define pb push_back #define fer(i,a,b) for(int i=a;i<=b;++i) #define der(i,a,b) for(int i=a;i>=b;--i) #define all(x) (x).begin(),(x).end() #define pll pair<int,int> #define et cout<<'\n' #define xx first #define yy second using namespace std; template <typename _Tp>void input(_Tp &x){ char ch(getchar());bool f(false);while(!isdigit(ch))f|=ch==45,ch=getchar(); x=ch&15,ch=getchar();while(isdigit(ch))x=x*10+(ch&15),ch=getchar(); if(f)x=-x; } template <typename _Tp,typename... Args>void input(_Tp &t,Args &...args){input(t);input(args...);} vector<pll> v; int n,x,y; int mp[2100]; signed main() { input(n,x,y); fer(i,1,n-1){ fer(j,i+1,n){ mp[min(j-i,abs(j-y)+abs(x-i)+1)]++; } } for(int i=1;i<n;i++) cout<<mp[i]<<'\n'; }Python :
# coding=utf-8 N,X,Y=map(int,input().split()) c=[0]*~-N for j in range(N): for i in range(j):c[min(j+~i,abs(X+~i)+abs(Y+~j))]+=1 print(*c)
- 1
信息
- ID
- 12834
- 时间
- 2000ms
- 内存
- 1024MiB
- 难度
- 6
- 标签
- 递交数
- 104
- 已通过
- 29
- 上传者