久违的写篇博客吧 

A. Competitive Programmer

题目链接:https://codeforces.com/contest/1266/problem/A

题意:

给你一个只包含数字的字符串,你可以将字符串随机排列,问最后组成的数字能否被60整除

分析:

我们先考虑能被6整除的数的特点:

①各个位数和 % 3 == 0

②末尾数必须为 0 2 4 6 8中的一个

再考虑能被10整除的数的特点:

末尾数必须为0

因为60中6在十位部分 ,10在个位部分,所以最后组成的数除了各个位数和 % 3 == 0 外十位部分必须为0 、2 、4、6、8 中的一个, 个位数必须为0。

#include<bits/stdc++.h>
#define ios std::ios::sync_with_stdio(false)
#define sd(n) scanf("%d",&n)
#define sdd(n,m) scanf("%d%d",&n,&m)
#define sddd(n,m,k) scanf("%d%d%d",&n,&m,&k)
#define pd(n) printf("%d\n", (n))
#define pdd(n,m) printf("%d %d\n", n, m)
#define pld(n) printf("%lld\n", n)
#define pldd(n,m) printf("%lld %lld\n", n, m)
#define sld(n) scanf("%lld",&n)
#define sldd(n,m) scanf("%lld%lld",&n,&m)
#define slddd(n,m,k) scanf("%lld%lld%lld",&n,&m,&k)
#define sf(n) scanf("%lf",&n)
#define sff(n,m) scanf("%lf%lf",&n,&m)
#define sfff(n,m,k) scanf("%lf%lf%lf",&n,&m,&k)
#define rep(i,a,n) for (int i=a;i<=n;i++)
#define per(i,n,a) for (int i=n;i>=a;i--)
#define mm(a,n) memset(a, n, sizeof(a))
#define pb push_back
#define all(x) (x).begin(),(x).end()
#define fi first
#define se second
#define il inline
#define ll long long
#define lson rt << 1
#define rson rt << 1 | 1
#define MOD 1000000007
#define pi 3.14159265358979323
#define debug(x) cout <<#x<<": "<<x<<endl
#define debug2(x, y) cout <<#x<<": "<<x<<" | "<<#y<<": "<<y<<endl;
#define debug3(x, y, z) cout <<#x<<": "<<x<<" | "<<#y<<": "<<y<<" | "<<#z<<": "<<z<<endl;
#define debug4(a, b, c, d) cout <<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<endl;
using namespace std;
const ll INF (0x3f3f3f3f3f3f3f3fll);
const int inf (0x3f3f3f3f);
template<typename T>void read(T &res){bool flag=false;char ch;while(!isdigit(ch=getchar()))(ch=='-')&&(flag=true);
for(res=ch-;isdigit(ch=getchar());res=(res<<)+(res<<)+ch - );flag&&(res=-res);}
template<typename T>void Out(T x){if(x<)putchar('-'),x=-x;if(x>)Out(x/);putchar(x%+'');}
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
ll lcm(ll a,ll b){return a*b/gcd(a,b);}
ll pow_mod(ll x,ll n,ll mod){ll res=;while(n){if(n&)res=res*x%mod;x=x*x%mod;n>>=;}return res;}
ll fact_pow(ll n,ll p){ll res=;while(n){n/=p;res+=n;}return res;}
ll mult(ll a,ll b,ll p){a%=p;b%=p;ll r=,v=a;while(b){if(b&){r+=v;if(r>p)r-=p;}v<<=;if(v>p)v-=p;b>>=;}return r;}
ll quick_pow(ll a,ll b,ll p){ll r=,v=a%p;while(b){if(b&)r=mult(r,v,p);v=mult(v,v,p);b>>=;}return r;}
bool CH(ll a,ll n,ll x,ll t)
{ll r=quick_pow(a,x,n);ll z=r;for(ll i=;i<=t;i++){r=mult(r,r,n);if(r==&&z!=&&z!=n-)return true;z=r;}return r!=;}
bool Miller_Rabin(ll n)
{if(n<)return false;if(n==)return true;if(!(n&))return false;ll x=n-,t=;while(!(x&)){x>>=;t++;}srand(time(NULL));
ll o=;for(ll i=;i<o;i++){ll a=rand()%(n-)+;if(CH(a,n,x,t))return false;}return true;}
/*
int prime[30000010],minprime[30000010];
void euler(int n)
{int c=0,i,j;for(i=2;i<=n;i++){if(!minprime[i])prime[++c]=i,minprime[i]=i;for(j=1;j<=c&&i*prime[j]<=n;j++)
{minprime[i*prime[j]]=prime[j];if(i%prime[j]==0)break;}}}
struct Tree{ll l,r,sum,lazy,maxn,minn;}tree[1000000];
il void push_up(ll rt)
{tree[rt].sum=tree[rt<<1].sum+tree[rt<<1|1].sum;
tree[rt].maxn=max(tree[rt<<1].maxn,tree[rt<<1|1].maxn);
tree[rt].minn=min(tree[rt<<1].minn,tree[rt<<1|1].minn);}
il void push_down(ll rt , ll now)
{if(tree[rt].lazy){tree[rt<<1].lazy+=tree[rt].lazy;tree[rt<<1|1].lazy+=tree[rt].lazy;
tree[rt<<1].sum+=(now-(now>>1))*tree[rt].lazy;tree[rt<<1|1].sum+=(now>>1)*tree[rt].lazy;
tree[rt<<1].minn+=tree[rt].lazy;tree[rt<<1|1].minn+=tree[rt].lazy;
tree[rt<<1].maxn+=tree[rt].lazy;tree[rt<<1|1].maxn+=tree[rt].lazy;tree[rt].lazy=0;}}
il void build(ll l , ll r , ll rt , ll *aa)
{tree[rt].lazy=0;tree[rt].l=l;tree[rt].r=r;if(l==r)
{tree[rt].sum=aa[l];tree[rt].minn=tree[rt].sum;tree[rt].maxn=tree[rt].sum;return;}
ll mid=(l+r)>>1;build(l,mid,rt<<1,aa);build(mid+1,r,rt<<1|1,aa);push_up(rt);}
il void update_range(ll L , ll R , ll key , ll rt)
{if(L<=tree[rt].l&&R>=tree[rt].r){tree[rt].sum+=(tree[rt].r-tree[rt].l+1)*key;
tree[rt].minn+=key;tree[rt].maxn+=key;tree[rt].lazy+=key;return;}push_down(rt,tree[rt].r-tree[rt].l+1);
ll mid=(tree[rt].r+tree[rt].l)>>1;if(L<=mid)update_range(L,R,key,lson);
if(R>mid)update_range(L,R,key,rson);push_up(rt);}
il ll query_range(ll L, ll R, ll rt)
{if(L<=tree[rt].l&&R>=tree[rt].r){return tree[rt].sum;}push_down(rt,tree[rt].r-tree[rt].l+1);
ll mid=(tree[rt].r+tree[rt].l)>>1;ll ans=0;if(L<=mid)ans+=query_range(L,R,lson);
if(R>mid)ans+=query_range(L,R,rson);return ans;}
il ll query_min(ll L,ll R,ll rt)
{if(L<=tree[rt].l&&R>=tree[rt].r){return tree[rt].minn;}push_down(rt,tree[rt].r-tree[rt].l+1);
ll mid=(tree[rt].r+tree[rt].l)>>1;ll ans=(0x3f3f3f3f3f3f3f3fll);if(L<=mid)ans=min(ans,query_min(L,R,lson));
if(R>mid)ans=min(ans,query_min(L,R,rson));return ans;}
il ll query_max(ll L, ll R, ll rt)
{if(L<=tree[rt].l&&R>=tree[rt].r){return tree[rt].maxn;}push_down(rt,tree[rt].r-tree[rt].l+1);
ll mid=(tree[rt].r+tree[rt].l)>>1;ll ans=-(0x3f3f3f3f3f3f3f3fll);if(L<=mid)ans=max(ans,query_max(L,R,lson));
if(R>mid)ans=max(ans,query_max(L,R,rson));return ans;}
*/
const int N = 1e3 + ;
ll a[N][N];
map<int , int>ha;
int main()
{
ios;
int n ;
cin >> n;
while(n --)
{
ha.clear();
string s;
cin >> s;
int len = s.size() - ;
int tot = ;
rep(j , , len)
{
ha[s[j] - ''] ++;
tot += s[j] - '';
}
if(ha[] && (ha[] || ha[] || ha[] || ha[] || (ha[] - )) && tot % == )
cout << "red" << '\n';
else cout << "cyan" << '\n'; }
return ;
}

B. Dice Tower

题目链接:https://codeforces.com/contest/1266/problem/B

题意:

你有无限个骰子,你可以从中选出任意个来拼搭,问“没有被挡住的点数的和”能否组成某个数X

分析:

首先一个骰子所有点数和为21 , 并且1的对立面为6,2的对立面为5,3对立面为4。

当骰子只有一个的时候,它被挡住的只会它的底部,那么它可以组成的数就为21 - (1~6) = 15 ~ 20

当骰子有两个的时候,因为它们要拼搭在一起,所以第一个骰子会被第二个骰子挡住一个面,第二个骰子会被第一个骰子挡住一个面,并且这两个面是对立的

所以当第二个骰子加入的时候,总的点数为原先点数 + 21(第二个骰子的总点数) - 7(第二个骰子加入时减去的部分) =  (15 ~ 20) + 14

加入第三个第四个第五个。。。第n个同理 , 最后的总点数就为 (15 ~ 20) + 14 * (n - 1) , 所以如果可以拼凑出X则 X % 14 的答案为 (15 ~ 20 )% 14 = 1 ~ 6

所以最后只要判断X是否大于等于15并且 X % 14 在不在 1 ~ 6 这个范围就可以了

#include<bits/stdc++.h>
#define ios std::ios::sync_with_stdio(false)
#define sd(n) scanf("%d",&n)
#define sdd(n,m) scanf("%d%d",&n,&m)
#define sddd(n,m,k) scanf("%d%d%d",&n,&m,&k)
#define pd(n) printf("%d\n", (n))
#define pdd(n,m) printf("%d %d\n", n, m)
#define pld(n) printf("%lld\n", n)
#define pldd(n,m) printf("%lld %lld\n", n, m)
#define sld(n) scanf("%lld",&n)
#define sldd(n,m) scanf("%lld%lld",&n,&m)
#define slddd(n,m,k) scanf("%lld%lld%lld",&n,&m,&k)
#define sf(n) scanf("%lf",&n)
#define sff(n,m) scanf("%lf%lf",&n,&m)
#define sfff(n,m,k) scanf("%lf%lf%lf",&n,&m,&k)
#define rep(i,a,n) for (int i=a;i<=n;i++)
#define per(i,n,a) for (int i=n;i>=a;i--)
#define mm(a,n) memset(a, n, sizeof(a))
#define pb push_back
#define all(x) (x).begin(),(x).end()
#define fi first
#define se second
#define il inline
#define ll long long
#define lson rt << 1
#define rson rt << 1 | 1
#define MOD 1000000007
#define pi 3.14159265358979323
#define debug(x) cout <<#x<<": "<<x<<endl
#define debug2(x, y) cout <<#x<<": "<<x<<" | "<<#y<<": "<<y<<endl;
#define debug3(x, y, z) cout <<#x<<": "<<x<<" | "<<#y<<": "<<y<<" | "<<#z<<": "<<z<<endl;
#define debug4(a, b, c, d) cout <<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<endl;
using namespace std;
const ll INF (0x3f3f3f3f3f3f3f3fll);
const int inf (0x3f3f3f3f);
template<typename T>void read(T &res){bool flag=false;char ch;while(!isdigit(ch=getchar()))(ch=='-')&&(flag=true);
for(res=ch-;isdigit(ch=getchar());res=(res<<)+(res<<)+ch - );flag&&(res=-res);}
template<typename T>void Out(T x){if(x<)putchar('-'),x=-x;if(x>)Out(x/);putchar(x%+'');}
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
ll lcm(ll a,ll b){return a*b/gcd(a,b);}
ll pow_mod(ll x,ll n,ll mod){ll res=;while(n){if(n&)res=res*x%mod;x=x*x%mod;n>>=;}return res;}
ll fact_pow(ll n,ll p){ll res=;while(n){n/=p;res+=n;}return res;}
ll mult(ll a,ll b,ll p){a%=p;b%=p;ll r=,v=a;while(b){if(b&){r+=v;if(r>p)r-=p;}v<<=;if(v>p)v-=p;b>>=;}return r;}
ll quick_pow(ll a,ll b,ll p){ll r=,v=a%p;while(b){if(b&)r=mult(r,v,p);v=mult(v,v,p);b>>=;}return r;}
bool CH(ll a,ll n,ll x,ll t)
{ll r=quick_pow(a,x,n);ll z=r;for(ll i=;i<=t;i++){r=mult(r,r,n);if(r==&&z!=&&z!=n-)return true;z=r;}return r!=;}
bool Miller_Rabin(ll n)
{if(n<)return false;if(n==)return true;if(!(n&))return false;ll x=n-,t=;while(!(x&)){x>>=;t++;}srand(time(NULL));
ll o=;for(ll i=;i<o;i++){ll a=rand()%(n-)+;if(CH(a,n,x,t))return false;}return true;}
/*
int prime[30000010],minprime[30000010];
void euler(int n)
{int c=0,i,j;for(i=2;i<=n;i++){if(!minprime[i])prime[++c]=i,minprime[i]=i;for(j=1;j<=c&&i*prime[j]<=n;j++)
{minprime[i*prime[j]]=prime[j];if(i%prime[j]==0)break;}}}
struct Tree{ll l,r,sum,lazy,maxn,minn;}tree[1000000];
il void push_up(ll rt)
{tree[rt].sum=tree[rt<<1].sum+tree[rt<<1|1].sum;
tree[rt].maxn=max(tree[rt<<1].maxn,tree[rt<<1|1].maxn);
tree[rt].minn=min(tree[rt<<1].minn,tree[rt<<1|1].minn);}
il void push_down(ll rt , ll now)
{if(tree[rt].lazy){tree[rt<<1].lazy+=tree[rt].lazy;tree[rt<<1|1].lazy+=tree[rt].lazy;
tree[rt<<1].sum+=(now-(now>>1))*tree[rt].lazy;tree[rt<<1|1].sum+=(now>>1)*tree[rt].lazy;
tree[rt<<1].minn+=tree[rt].lazy;tree[rt<<1|1].minn+=tree[rt].lazy;
tree[rt<<1].maxn+=tree[rt].lazy;tree[rt<<1|1].maxn+=tree[rt].lazy;tree[rt].lazy=0;}}
il void build(ll l , ll r , ll rt , ll *aa)
{tree[rt].lazy=0;tree[rt].l=l;tree[rt].r=r;if(l==r)
{tree[rt].sum=aa[l];tree[rt].minn=tree[rt].sum;tree[rt].maxn=tree[rt].sum;return;}
ll mid=(l+r)>>1;build(l,mid,rt<<1,aa);build(mid+1,r,rt<<1|1,aa);push_up(rt);}
il void update_range(ll L , ll R , ll key , ll rt)
{if(L<=tree[rt].l&&R>=tree[rt].r){tree[rt].sum+=(tree[rt].r-tree[rt].l+1)*key;
tree[rt].minn+=key;tree[rt].maxn+=key;tree[rt].lazy+=key;return;}push_down(rt,tree[rt].r-tree[rt].l+1);
ll mid=(tree[rt].r+tree[rt].l)>>1;if(L<=mid)update_range(L,R,key,lson);
if(R>mid)update_range(L,R,key,rson);push_up(rt);}
il ll query_range(ll L, ll R, ll rt)
{if(L<=tree[rt].l&&R>=tree[rt].r){return tree[rt].sum;}push_down(rt,tree[rt].r-tree[rt].l+1);
ll mid=(tree[rt].r+tree[rt].l)>>1;ll ans=0;if(L<=mid)ans+=query_range(L,R,lson);
if(R>mid)ans+=query_range(L,R,rson);return ans;}
il ll query_min(ll L,ll R,ll rt)
{if(L<=tree[rt].l&&R>=tree[rt].r){return tree[rt].minn;}push_down(rt,tree[rt].r-tree[rt].l+1);
ll mid=(tree[rt].r+tree[rt].l)>>1;ll ans=(0x3f3f3f3f3f3f3f3fll);if(L<=mid)ans=min(ans,query_min(L,R,lson));
if(R>mid)ans=min(ans,query_min(L,R,rson));return ans;}
il ll query_max(ll L, ll R, ll rt)
{if(L<=tree[rt].l&&R>=tree[rt].r){return tree[rt].maxn;}push_down(rt,tree[rt].r-tree[rt].l+1);
ll mid=(tree[rt].r+tree[rt].l)>>1;ll ans=-(0x3f3f3f3f3f3f3f3fll);if(L<=mid)ans=max(ans,query_max(L,R,lson));
if(R>mid)ans=max(ans,query_max(L,R,rson));return ans;}
*/
const int N = 1e3 + ;
ll a[N][N];
map<int , int>ha;
int main()
{
ios;
int t;
cin >> t;
while(t --)
{
ll x;
cin >> x;
if(x < )
{
cout << "NO" << '\n';
continue;
}
x %= ;
if(x > || x < )
cout << "NO" << '\n';
else
cout << "YES" << '\n';
}
return ;
}

C. Diverse Matrix

题目链接:https://codeforces.com/contest/1266/problem/C

题意:

要求构造一个 r 行 c 列的矩阵, 并且矩阵的每一行的gcd和每一列的gcd的都只出现过一次,且每行的gcd都要求最小

分析:

首先当 r = 1 && c = 1 的时候, 它的行gcd和列gcd为同一元素, 所以是无法构造出来的

当 r = 1 或者 c = 1 时 , 我们可以 1 2 3 4 5 6 ... 输出

对于其它的可能,我们考虑这么构造:

假设 r = 2 , c = 2 , A 、B 、C 、D 为矩阵元素

1 |  A   C

2 |  B   D    我们可以让第一行的gcd结果为1 , 第二行gcd结果为2,第一列gcd结果为3,第二列gcd结果为4

 3   4

则 A = 1 * 3 , B = 2 * 3 , C = 1 * 4 , D = 2 * 4 这样构造即可

#include<bits/stdc++.h>
#define ios std::ios::sync_with_stdio(false)
#define sd(n) scanf("%d",&n)
#define sdd(n,m) scanf("%d%d",&n,&m)
#define sddd(n,m,k) scanf("%d%d%d",&n,&m,&k)
#define pd(n) printf("%d\n", (n))
#define pdd(n,m) printf("%d %d\n", n, m)
#define pld(n) printf("%lld\n", n)
#define pldd(n,m) printf("%lld %lld\n", n, m)
#define sld(n) scanf("%lld",&n)
#define sldd(n,m) scanf("%lld%lld",&n,&m)
#define slddd(n,m,k) scanf("%lld%lld%lld",&n,&m,&k)
#define sf(n) scanf("%lf",&n)
#define sff(n,m) scanf("%lf%lf",&n,&m)
#define sfff(n,m,k) scanf("%lf%lf%lf",&n,&m,&k)
#define rep(i,a,n) for (int i=a;i<=n;i++)
#define per(i,n,a) for (int i=n;i>=a;i--)
#define mm(a,n) memset(a, n, sizeof(a))
#define pb push_back
#define all(x) (x).begin(),(x).end()
#define fi first
#define se second
#define il inline
#define ll long long
#define lson rt << 1
#define rson rt << 1 | 1
#define MOD 1000000007
#define pi 3.14159265358979323
#define debug(x) cout <<#x<<": "<<x<<endl
#define debug2(x, y) cout <<#x<<": "<<x<<" | "<<#y<<": "<<y<<endl;
#define debug3(x, y, z) cout <<#x<<": "<<x<<" | "<<#y<<": "<<y<<" | "<<#z<<": "<<z<<endl;
#define debug4(a, b, c, d) cout <<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<endl;
using namespace std;
const ll INF (0x3f3f3f3f3f3f3f3fll);
const int inf (0x3f3f3f3f);
template<typename T>void read(T &res){bool flag=false;char ch;while(!isdigit(ch=getchar()))(ch=='-')&&(flag=true);
for(res=ch-;isdigit(ch=getchar());res=(res<<)+(res<<)+ch - );flag&&(res=-res);}
template<typename T>void Out(T x){if(x<)putchar('-'),x=-x;if(x>)Out(x/);putchar(x%+'');}
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
ll lcm(ll a,ll b){return a*b/gcd(a,b);}
ll pow_mod(ll x,ll n,ll mod){ll res=;while(n){if(n&)res=res*x%mod;x=x*x%mod;n>>=;}return res;}
ll fact_pow(ll n,ll p){ll res=;while(n){n/=p;res+=n;}return res;}
ll mult(ll a,ll b,ll p){a%=p;b%=p;ll r=,v=a;while(b){if(b&){r+=v;if(r>p)r-=p;}v<<=;if(v>p)v-=p;b>>=;}return r;}
ll quick_pow(ll a,ll b,ll p){ll r=,v=a%p;while(b){if(b&)r=mult(r,v,p);v=mult(v,v,p);b>>=;}return r;}
bool CH(ll a,ll n,ll x,ll t)
{ll r=quick_pow(a,x,n);ll z=r;for(ll i=;i<=t;i++){r=mult(r,r,n);if(r==&&z!=&&z!=n-)return true;z=r;}return r!=;}
bool Miller_Rabin(ll n)
{if(n<)return false;if(n==)return true;if(!(n&))return false;ll x=n-,t=;while(!(x&)){x>>=;t++;}srand(time(NULL));
ll o=;for(ll i=;i<o;i++){ll a=rand()%(n-)+;if(CH(a,n,x,t))return false;}return true;}
/*
int prime[30000010],minprime[30000010];
void euler(int n)
{int c=0,i,j;for(i=2;i<=n;i++){if(!minprime[i])prime[++c]=i,minprime[i]=i;for(j=1;j<=c&&i*prime[j]<=n;j++)
{minprime[i*prime[j]]=prime[j];if(i%prime[j]==0)break;}}}
struct Tree{ll l,r,sum,lazy,maxn,minn;}tree[1000000];
il void push_up(ll rt)
{tree[rt].sum=tree[rt<<1].sum+tree[rt<<1|1].sum;
tree[rt].maxn=max(tree[rt<<1].maxn,tree[rt<<1|1].maxn);
tree[rt].minn=min(tree[rt<<1].minn,tree[rt<<1|1].minn);}
il void push_down(ll rt , ll now)
{if(tree[rt].lazy){tree[rt<<1].lazy+=tree[rt].lazy;tree[rt<<1|1].lazy+=tree[rt].lazy;
tree[rt<<1].sum+=(now-(now>>1))*tree[rt].lazy;tree[rt<<1|1].sum+=(now>>1)*tree[rt].lazy;
tree[rt<<1].minn+=tree[rt].lazy;tree[rt<<1|1].minn+=tree[rt].lazy;
tree[rt<<1].maxn+=tree[rt].lazy;tree[rt<<1|1].maxn+=tree[rt].lazy;tree[rt].lazy=0;}}
il void build(ll l , ll r , ll rt , ll *aa)
{tree[rt].lazy=0;tree[rt].l=l;tree[rt].r=r;if(l==r)
{tree[rt].sum=aa[l];tree[rt].minn=tree[rt].sum;tree[rt].maxn=tree[rt].sum;return;}
ll mid=(l+r)>>1;build(l,mid,rt<<1,aa);build(mid+1,r,rt<<1|1,aa);push_up(rt);}
il void update_range(ll L , ll R , ll key , ll rt)
{if(L<=tree[rt].l&&R>=tree[rt].r){tree[rt].sum+=(tree[rt].r-tree[rt].l+1)*key;
tree[rt].minn+=key;tree[rt].maxn+=key;tree[rt].lazy+=key;return;}push_down(rt,tree[rt].r-tree[rt].l+1);
ll mid=(tree[rt].r+tree[rt].l)>>1;if(L<=mid)update_range(L,R,key,lson);
if(R>mid)update_range(L,R,key,rson);push_up(rt);}
il ll query_range(ll L, ll R, ll rt)
{if(L<=tree[rt].l&&R>=tree[rt].r){return tree[rt].sum;}push_down(rt,tree[rt].r-tree[rt].l+1);
ll mid=(tree[rt].r+tree[rt].l)>>1;ll ans=0;if(L<=mid)ans+=query_range(L,R,lson);
if(R>mid)ans+=query_range(L,R,rson);return ans;}
il ll query_min(ll L,ll R,ll rt)
{if(L<=tree[rt].l&&R>=tree[rt].r){return tree[rt].minn;}push_down(rt,tree[rt].r-tree[rt].l+1);
ll mid=(tree[rt].r+tree[rt].l)>>1;ll ans=(0x3f3f3f3f3f3f3f3fll);if(L<=mid)ans=min(ans,query_min(L,R,lson));
if(R>mid)ans=min(ans,query_min(L,R,rson));return ans;}
il ll query_max(ll L, ll R, ll rt)
{if(L<=tree[rt].l&&R>=tree[rt].r){return tree[rt].maxn;}push_down(rt,tree[rt].r-tree[rt].l+1);
ll mid=(tree[rt].r+tree[rt].l)>>1;ll ans=-(0x3f3f3f3f3f3f3f3fll);if(L<=mid)ans=max(ans,query_max(L,R,lson));
if(R>mid)ans=max(ans,query_max(L,R,rson));return ans;}
*/
const int N = 1e3 + ;
ll a[N][N];
int main()
{
ios;
ll r , c;
cin >> r >> c;
if(r == && c == )
return cout << << '\n' , ;
if(r == )
{
int tot = ;
rep(i , , c)
cout << tot ++ << ' ';
return ;
}
if(c == )
{
int tot = ;
rep(i , , r)
cout << tot ++ << "\n";
return ;
} rep(i , , r)
{
rep(j , , c)
{
a[i][j] = i * (j + r);
}
}
rep(i , , r)
{
rep(j , , c)
cout << a[i][j] << " ";
cout << '\n';
} return ;
}

D. Decreasing Debts

题目链接:https://codeforces.ml/contest/1266/problem/D

题意:

给你几个债务关系,如A欠B五元, B欠C五元,此时总的债务为 5 + 5 = 10 。

我们可以把关系转换为A欠C五元,那这样总的债务为 5

问不限转换次数 , 怎么把总债务化为最小。

分析:

当把总债务化为最小时 , 每个人的债务关系也将是最简的(以上述例子阐述,对B , 它欠C五元,这时候它的支出为5,但是A欠它五元,所以它的收入为5,所以它最后对总债务的关系为abs(5 - 5)= 0)

对于A、C也是一样的,所以最后A的最简形式为A支出5元,B的最简形式为0,C的最简形式为收入5元。按照这样,我们只要将A指向C即可

(因为总的收入和总的支出一定是相同的且题目也说债务关系数量最小,所以即使某个人 D 收入的金额大于另一个人 E 支出的金额,也可以先将E连向D,然后D的收入金额减去E的支出金额)

我们用 in 容器来存最简形式为收入的人的编号, ou容器来存最简形式为支出的人的编号,再用指针one指向in里的元素,two指向ou里的元素,他们的债务可以表示为min(a[one] , a[two]) , 将关系存于ans容器里。

当one == in.size() || two == ou.size() 即已经没有支出的人或已经没有收入的人了,则债务关系可以结束储存(题目要求最后输出债务关系)

#include<bits/stdc++.h>
#define ios std::ios::sync_with_stdio(false)
#define sd(n) scanf("%d",&n)
#define sdd(n,m) scanf("%d%d",&n,&m)
#define sddd(n,m,k) scanf("%d%d%d",&n,&m,&k)
#define pd(n) printf("%d\n", (n))
#define pdd(n,m) printf("%d %d\n", n, m)
#define pld(n) printf("%lld\n", n)
#define pldd(n,m) printf("%lld %lld\n", n, m)
#define sld(n) scanf("%lld",&n)
#define sldd(n,m) scanf("%lld%lld",&n,&m)
#define slddd(n,m,k) scanf("%lld%lld%lld",&n,&m,&k)
#define sf(n) scanf("%lf",&n)
#define sff(n,m) scanf("%lf%lf",&n,&m)
#define sfff(n,m,k) scanf("%lf%lf%lf",&n,&m,&k)
#define rep(i,a,n) for (int i=a;i<=n;i++)
#define per(i,n,a) for (int i=n;i>=a;i--)
#define mm(a,n) memset(a, n, sizeof(a))
#define pb push_back
#define all(x) (x).begin(),(x).end()
#define fi first
#define se second
#define il inline
#define ll long long
#define lson rt << 1
#define rson rt << 1 | 1
#define MOD 1000000007
#define pi 3.14159265358979323
#define debug(x) cout <<#x<<": "<<x<<endl
#define debug2(x, y) cout <<#x<<": "<<x<<" | "<<#y<<": "<<y<<endl;
#define debug3(x, y, z) cout <<#x<<": "<<x<<" | "<<#y<<": "<<y<<" | "<<#z<<": "<<z<<endl;
#define debug4(a, b, c, d) cout <<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<endl;
using namespace std;
const ll INF (0x3f3f3f3f3f3f3f3fll);
const int inf (0x3f3f3f3f);
template<typename T>void read(T &res){bool flag=false;char ch;while(!isdigit(ch=getchar()))(ch=='-')&&(flag=true);
for(res=ch-;isdigit(ch=getchar());res=(res<<)+(res<<)+ch - );flag&&(res=-res);}
template<typename T>void Out(T x){if(x<)putchar('-'),x=-x;if(x>)Out(x/);putchar(x%+'');}
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
ll lcm(ll a,ll b){return a*b/gcd(a,b);}
ll pow_mod(ll x,ll n,ll mod){ll res=;while(n){if(n&)res=res*x%mod;x=x*x%mod;n>>=;}return res;}
ll fact_pow(ll n,ll p){ll res=;while(n){n/=p;res+=n;}return res;}
ll mult(ll a,ll b,ll p){a%=p;b%=p;ll r=,v=a;while(b){if(b&){r+=v;if(r>p)r-=p;}v<<=;if(v>p)v-=p;b>>=;}return r;}
ll quick_pow(ll a,ll b,ll p){ll r=,v=a%p;while(b){if(b&)r=mult(r,v,p);v=mult(v,v,p);b>>=;}return r;}
bool CH(ll a,ll n,ll x,ll t)
{ll r=quick_pow(a,x,n);ll z=r;for(ll i=;i<=t;i++){r=mult(r,r,n);if(r==&&z!=&&z!=n-)return true;z=r;}return r!=;}
bool Miller_Rabin(ll n)
{if(n<)return false;if(n==)return true;if(!(n&))return false;ll x=n-,t=;while(!(x&)){x>>=;t++;}srand(time(NULL));
ll o=;for(ll i=;i<o;i++){ll a=rand()%(n-)+;if(CH(a,n,x,t))return false;}return true;}
/*
int prime[30000010],minprime[30000010];
void euler(int n)
{int c=0,i,j;for(i=2;i<=n;i++){if(!minprime[i])prime[++c]=i,minprime[i]=i;for(j=1;j<=c&&i*prime[j]<=n;j++)
{minprime[i*prime[j]]=prime[j];if(i%prime[j]==0)break;}}}
struct Tree{ll l,r,sum,lazy,maxn,minn;}tree[1000000];
il void push_up(ll rt)
{tree[rt].sum=tree[rt<<1].sum+tree[rt<<1|1].sum;
tree[rt].maxn=max(tree[rt<<1].maxn,tree[rt<<1|1].maxn);
tree[rt].minn=min(tree[rt<<1].minn,tree[rt<<1|1].minn);}
il void push_down(ll rt , ll now)
{if(tree[rt].lazy){tree[rt<<1].lazy+=tree[rt].lazy;tree[rt<<1|1].lazy+=tree[rt].lazy;
tree[rt<<1].sum+=(now-(now>>1))*tree[rt].lazy;tree[rt<<1|1].sum+=(now>>1)*tree[rt].lazy;
tree[rt<<1].minn+=tree[rt].lazy;tree[rt<<1|1].minn+=tree[rt].lazy;
tree[rt<<1].maxn+=tree[rt].lazy;tree[rt<<1|1].maxn+=tree[rt].lazy;tree[rt].lazy=0;}}
il void build(ll l , ll r , ll rt , ll *aa)
{tree[rt].lazy=0;tree[rt].l=l;tree[rt].r=r;if(l==r)
{tree[rt].sum=aa[l];tree[rt].minn=tree[rt].sum;tree[rt].maxn=tree[rt].sum;return;}
ll mid=(l+r)>>1;build(l,mid,rt<<1,aa);build(mid+1,r,rt<<1|1,aa);push_up(rt);}
il void update_range(ll L , ll R , ll key , ll rt)
{if(L<=tree[rt].l&&R>=tree[rt].r){tree[rt].sum+=(tree[rt].r-tree[rt].l+1)*key;
tree[rt].minn+=key;tree[rt].maxn+=key;tree[rt].lazy+=key;return;}push_down(rt,tree[rt].r-tree[rt].l+1);
ll mid=(tree[rt].r+tree[rt].l)>>1;if(L<=mid)update_range(L,R,key,lson);
if(R>mid)update_range(L,R,key,rson);push_up(rt);}
il ll query_range(ll L, ll R, ll rt)
{if(L<=tree[rt].l&&R>=tree[rt].r){return tree[rt].sum;}push_down(rt,tree[rt].r-tree[rt].l+1);
ll mid=(tree[rt].r+tree[rt].l)>>1;ll ans=0;if(L<=mid)ans+=query_range(L,R,lson);
if(R>mid)ans+=query_range(L,R,rson);return ans;}
il ll query_min(ll L,ll R,ll rt)
{if(L<=tree[rt].l&&R>=tree[rt].r){return tree[rt].minn;}push_down(rt,tree[rt].r-tree[rt].l+1);
ll mid=(tree[rt].r+tree[rt].l)>>1;ll ans=(0x3f3f3f3f3f3f3f3fll);if(L<=mid)ans=min(ans,query_min(L,R,lson));
if(R>mid)ans=min(ans,query_min(L,R,rson));return ans;}
il ll query_max(ll L, ll R, ll rt)
{if(L<=tree[rt].l&&R>=tree[rt].r){return tree[rt].maxn;}push_down(rt,tree[rt].r-tree[rt].l+1);
ll mid=(tree[rt].r+tree[rt].l)>>1;ll ans=-(0x3f3f3f3f3f3f3f3fll);if(L<=mid)ans=max(ans,query_max(L,R,lson));
if(R>mid)ans=max(ans,query_max(L,R,rson));return ans;}
*/
const int N = 3e5 + ;
ll a[N];
vector<ll>in , ou;
vector<pair<pair<ll , ll>, ll> > ans;
int main()
{
ios;
ll n , m ;
cin >> n >> m;
rep(i , , m)
{
ll x , y , z;
cin >> x >> y >> z;
a[x] += z;
a[y] -= z;
}
rep(i , , n)
{
if(a[i] > )
in.pb(i);
else if(a[i] < )
ou.pb(i);
}
ll one = , two = ;
while(true)
{
if(one == in.size() || two == ou.size())
break;
ll ha = min(a[in[one]] , -a[ou[two]]);
ans.pb(make_pair(make_pair(in[one] , ou[two]) , ha));
a[in[one]] -= ha;
a[ou[two]] += ha;
if(!a[in[one]]) one ++;
if(!a[ou[two]]) two ++;
}
ll len = ans.size();
cout << len << '\n';
rep(i , , len - )
cout << ans[i].fi.fi << " " << ans[i].fi.se << " " << ans[i].se << "\n";
return ;
}

E. Spaceship Solitaire

题目链接:https://codeforces.ml/contest/1266/problem/E

题意:

你要建个飞船 , 建飞船需要 n 种资源 , 每种资源的需求量为 a[i] 。每一回合你只能选择一种资源并生产一个。然后你有里程牌???

里程碑包含三个元素 S 、 T 、 U , 意思是如果你有 T 个 S 资源, 你就可以获得一个U资源。(0 < T < a[S])

不同的里程碑 S 和 T 不相同 (如果S 相同且 T 相同则它们是同一个里程碑)

给你 q 次询问, 每次询问会加入一个里程碑(如果该里程碑先前存在过 , 则用现在的里程碑代替之前的里程碑 , 如果U == 0 , 则销毁该里程碑)

问建造飞船最少需要多少回合

分析:

i 种资源 每种需要 a[i] 个,那么当没有里程碑的情况下总的回合数为 a[1] + a[2] + ... + a[n] , 记为sum

首先我们要知道的是,不论如何,最后飞船是肯定可以建成的。又因为对任意里程碑 T < a[S] , 所以里程碑起作用的条件是肯定可以满足的 ,那么对于当前询问加入的里程碑来说

如果它先前出现过,则我们判断它先前出现的时候是否会对sum起影响(因为可能在该里程碑起作用之前,资源U已经采集的够了,所以该里程碑不起到作用。如果在起作用前U采集还不够,则它起到作用了, sum 会减一)

如果不影响,sum保持不变,影响了,则sum++(把先前造成的影响去掉)

然后我们判断新的里程碑是否起作用(如果起作用sum -- , 否则sum不变),对于每个询问输出sum即可。(只需判断当前类型里程碑,其他里程碑不受影响)

简单模拟题。

#include<bits/stdc++.h>
#define ios std::ios::sync_with_stdio(false)
#define sd(n) scanf("%d",&n)
#define sdd(n,m) scanf("%d%d",&n,&m)
#define sddd(n,m,k) scanf("%d%d%d",&n,&m,&k)
#define pd(n) printf("%d\n", (n))
#define pdd(n,m) printf("%d %d\n", n, m)
#define pld(n) printf("%lld\n", n)
#define pldd(n,m) printf("%lld %lld\n", n, m)
#define sld(n) scanf("%lld",&n)
#define sldd(n,m) scanf("%lld%lld",&n,&m)
#define slddd(n,m,k) scanf("%lld%lld%lld",&n,&m,&k)
#define sf(n) scanf("%lf",&n)
#define sff(n,m) scanf("%lf%lf",&n,&m)
#define sfff(n,m,k) scanf("%lf%lf%lf",&n,&m,&k)
#define rep(i,a,n) for (int i=a;i<=n;i++)
#define per(i,n,a) for (int i=n;i>=a;i--)
#define mm(a,n) memset(a, n, sizeof(a))
#define pb push_back
#define all(x) (x).begin(),(x).end()
#define fi first
#define se second
#define il inline
#define ll long long
#define lson rt << 1
#define rson rt << 1 | 1
#define MOD 1000000007
#define pi 3.14159265358979323
#define debug(x) cout <<#x<<": "<<x<<endl
#define debug2(x, y) cout <<#x<<": "<<x<<" | "<<#y<<": "<<y<<endl;
#define debug3(x, y, z) cout <<#x<<": "<<x<<" | "<<#y<<": "<<y<<" | "<<#z<<": "<<z<<endl;
#define debug4(a, b, c, d) cout <<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<endl;
using namespace std;
const ll INF (0x3f3f3f3f3f3f3f3fll);
const int inf (0x3f3f3f3f);
template<typename T>void read(T &res){bool flag=false;char ch;while(!isdigit(ch=getchar()))(ch=='-')&&(flag=true);
for(res=ch-;isdigit(ch=getchar());res=(res<<)+(res<<)+ch - );flag&&(res=-res);}
template<typename T>void Out(T x){if(x<)putchar('-'),x=-x;if(x>)Out(x/);putchar(x%+'');}
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
ll lcm(ll a,ll b){return a*b/gcd(a,b);}
ll pow_mod(ll x,ll n,ll mod){ll res=;while(n){if(n&)res=res*x%mod;x=x*x%mod;n>>=;}return res;}
ll fact_pow(ll n,ll p){ll res=;while(n){n/=p;res+=n;}return res;}
ll mult(ll a,ll b,ll p){a%=p;b%=p;ll r=,v=a;while(b){if(b&){r+=v;if(r>p)r-=p;}v<<=;if(v>p)v-=p;b>>=;}return r;}
ll quick_pow(ll a,ll b,ll p){ll r=,v=a%p;while(b){if(b&)r=mult(r,v,p);v=mult(v,v,p);b>>=;}return r;}
bool CH(ll a,ll n,ll x,ll t)
{ll r=quick_pow(a,x,n);ll z=r;for(ll i=;i<=t;i++){r=mult(r,r,n);if(r==&&z!=&&z!=n-)return true;z=r;}return r!=;}
bool Miller_Rabin(ll n)
{if(n<)return false;if(n==)return true;if(!(n&))return false;ll x=n-,t=;while(!(x&)){x>>=;t++;}srand(time(NULL));
ll o=;for(ll i=;i<o;i++){ll a=rand()%(n-)+;if(CH(a,n,x,t))return false;}return true;}
/*
int prime[30000010],minprime[30000010];
void euler(int n)
{int c=0,i,j;for(i=2;i<=n;i++){if(!minprime[i])prime[++c]=i,minprime[i]=i;for(j=1;j<=c&&i*prime[j]<=n;j++)
{minprime[i*prime[j]]=prime[j];if(i%prime[j]==0)break;}}}
struct Tree{ll l,r,sum,lazy,maxn,minn;}tree[1000000];
il void push_up(ll rt)
{tree[rt].sum=tree[rt<<1].sum+tree[rt<<1|1].sum;
tree[rt].maxn=max(tree[rt<<1].maxn,tree[rt<<1|1].maxn);
tree[rt].minn=min(tree[rt<<1].minn,tree[rt<<1|1].minn);}
il void push_down(ll rt , ll now)
{if(tree[rt].lazy){tree[rt<<1].lazy+=tree[rt].lazy;tree[rt<<1|1].lazy+=tree[rt].lazy;
tree[rt<<1].sum+=(now-(now>>1))*tree[rt].lazy;tree[rt<<1|1].sum+=(now>>1)*tree[rt].lazy;
tree[rt<<1].minn+=tree[rt].lazy;tree[rt<<1|1].minn+=tree[rt].lazy;
tree[rt<<1].maxn+=tree[rt].lazy;tree[rt<<1|1].maxn+=tree[rt].lazy;tree[rt].lazy=0;}}
il void build(ll l , ll r , ll rt , ll *aa)
{tree[rt].lazy=0;tree[rt].l=l;tree[rt].r=r;if(l==r)
{tree[rt].sum=aa[l];tree[rt].minn=tree[rt].sum;tree[rt].maxn=tree[rt].sum;return;}
ll mid=(l+r)>>1;build(l,mid,rt<<1,aa);build(mid+1,r,rt<<1|1,aa);push_up(rt);}
il void update_range(ll L , ll R , ll key , ll rt)
{if(L<=tree[rt].l&&R>=tree[rt].r){tree[rt].sum+=(tree[rt].r-tree[rt].l+1)*key;
tree[rt].minn+=key;tree[rt].maxn+=key;tree[rt].lazy+=key;return;}push_down(rt,tree[rt].r-tree[rt].l+1);
ll mid=(tree[rt].r+tree[rt].l)>>1;if(L<=mid)update_range(L,R,key,lson);
if(R>mid)update_range(L,R,key,rson);push_up(rt);}
il ll query_range(ll L, ll R, ll rt)
{if(L<=tree[rt].l&&R>=tree[rt].r){return tree[rt].sum;}push_down(rt,tree[rt].r-tree[rt].l+1);
ll mid=(tree[rt].r+tree[rt].l)>>1;ll ans=0;if(L<=mid)ans+=query_range(L,R,lson);
if(R>mid)ans+=query_range(L,R,rson);return ans;}
il ll query_min(ll L,ll R,ll rt)
{if(L<=tree[rt].l&&R>=tree[rt].r){return tree[rt].minn;}push_down(rt,tree[rt].r-tree[rt].l+1);
ll mid=(tree[rt].r+tree[rt].l)>>1;ll ans=(0x3f3f3f3f3f3f3f3fll);if(L<=mid)ans=min(ans,query_min(L,R,lson));
if(R>mid)ans=min(ans,query_min(L,R,rson));return ans;}
il ll query_max(ll L, ll R, ll rt)
{if(L<=tree[rt].l&&R>=tree[rt].r){return tree[rt].maxn;}push_down(rt,tree[rt].r-tree[rt].l+1);
ll mid=(tree[rt].r+tree[rt].l)>>1;ll ans=-(0x3f3f3f3f3f3f3f3fll);if(L<=mid)ans=max(ans,query_max(L,R,lson));
if(R>mid)ans=max(ans,query_max(L,R,rson));return ans;}
*/
const int N = 2e5 + ;
ll a[N] , sum;
map<ll , ll> vis[N];
int main()
{
ios;cin.tie();
int n , q;
cin >> n ;
rep(i , , n)
cin >> a[i] , sum += a[i];
cin >> q;
rep(i , , q)
{
ll s , t , u;
cin >> s >> t >> u;
if(vis[s][t])
{
a[vis[s][t]] ++;
if(a[vis[s][t]] > )
sum ++;
vis[s][t] = ;
}
if(u)
{
vis[s][t] = u;
a[u] --;
if(a[u] >= )
sum --;
}
cout << sum << '\n';
}
return ;
}

Codeforces Global Round 6的更多相关文章

  1. CodeForces Global Round 1

    CodeForces Global Round 1 CF新的比赛呢(虽然没啥区别)!这种报名的人多的比赛涨分是真的快.... 所以就写下题解吧. A. Parity 太简单了,随便模拟一下就完了. B ...

  2. Codeforces Global Round 1 - D. Jongmah(动态规划)

    Problem   Codeforces Global Round 1 - D. Jongmah Time Limit: 3000 mSec Problem Description Input Out ...

  3. Codeforces Global Round 2 题解

    Codeforces Global Round 2 题目链接:https://codeforces.com/contest/1119 A. Ilya and a Colorful Walk 题意: 给 ...

  4. Codeforces Global Round 1 (A-E题解)

    Codeforces Global Round 1 题目链接:https://codeforces.com/contest/1110 A. Parity 题意: 给出{ak},b,k,判断a1*b^( ...

  5. Codeforces Global Round 3

    Codeforces Global Round 3 A. Another One Bites The Dust 有若干个a,有若干个b,有若干个ab.你现在要把这些串拼成一个串,使得任意两个相邻的位置 ...

  6. Codeforces Global Round 1 (CF1110) (未完结,只有 A-F)

    Codeforces Global Round 1 (CF1110) 继续补题.因为看见同学打了这场,而且涨分还不错,所以觉得这套题目可能会比较有意思. 因为下午要开学了,所以恐怕暂时不能把这套题目补 ...

  7. 【手抖康复训练1 】Codeforces Global Round 6

    [手抖康复训练1 ]Codeforces Global Round 6 总结:不想复习随意打的一场,比赛开始就是熟悉的N分钟进不去时间,2333,太久没写题的后果就是:A 题手抖过不了样例 B题秒出思 ...

  8. Codeforces Global Round 11 个人题解(B题)

    Codeforces Global Round 11 1427A. Avoiding Zero 题目链接:click here 待补 1427B. Chess Cheater 题目链接:click h ...

  9. 【Codeforces Round 1110】Codeforces Global Round 1

    Codeforces Round 1110 这场比赛只做了\(A\).\(B\).\(C\),排名\(905\),不好. 主要的问题在\(D\)题上,有\(505\)人做出,但我没做出来. 考虑的时候 ...

  10. 树形DP ---- Codeforces Global Round 2 F. Niyaz and Small Degrees引发的一场血案

    Aspirations:没有结果,没有成绩,acm是否有意义?它最大的意义就是让我培养快速理解和应用一个个未知知识点的能力. ————————————————————————————————————— ...

随机推荐

  1. C# - VS2019 WinFrm应用程序开发报表 - ReportViewer控件初涉

    前言 简单报表我们可以通过label.textBox和PrintDialog来实现,但是一般在实际生产过程中,用户的报表需求一般都是比较复杂的. 本篇主要记录对于传统中国式复杂报表的处理方法和解决思路 ...

  2. 手把手带你一键部署 Kubernetes + KubeSphere 至 Linux

    本文介绍一个最快安装 Kubernetes 和体验 KubeSphere 核心功能的方式,all-in-one 模式可一键安装 Kubernetes v1.15.5 和 KubeSphere 至一台 ...

  3. Java 添加、读取、修改、删除Word文档属性

    Word文档属性包括常规.摘要.统计.内容.自定义等,其中摘要包括标题.主题.作者.经理.单位.类别.关键词.备注等项目,通过设置这些摘要信息或自定义属性可方便对文档的管理.本文中将主要介绍对文档摘要 ...

  4. 【NHOI2018】跳伞登山赛

    [题目描述] 某山区有高高低低的 n 个山峰,根据海拔高度的不同,这些山峰由低到高进行了 1 到 n 编号.有 m 条只能单向通行的羊肠小道连接这些山峰.现在,这里要举行一场跳伞登山赛,选手们伞降到某 ...

  5. day01_爬虫和数据

    1.什么是爬虫 1.1.爬虫的定义   脚本,程序--->自动抓取万维网上信息的程序. 1.2.爬虫的分类 ​ 2.1.通用爬虫 ​ 通用网络爬虫 是 捜索引擎抓取系统(Baidu.Google ...

  6. [需求设计]从一个小需求感受Redis的独特魅力

    分享一个简单的小需求应该怎么设计实现以及有关Redis的使用 Redis在实际应用中使用的非常广泛,本篇文章就从一个简单的需求说起,为你讲述一个需求是如何从头到尾开始做的,又是如何一步步完善的.之前写 ...

  7. 【RN - 基础】之React Native常见问题及解决方案

    unable to load script from assets index.android.bundle... 问题原因: 找不到Android项目中的assets文件夹. 解决方案: 1.在An ...

  8. 【Android - IPC】之ContentProvider简介

    1.Content Provider简介 Content Provider是Android中提供的一种专门用于不同应用之间进行数据共享的方式,从这一点来看,它天生就适合IPC(Inter-Proces ...

  9. Sting类字符串

    一.声明字符串 在java语言中字符串必须包含在一对双引号(" ")之内,但不能作为其他数据类型来使用,如"1+2"的输出结果不可能是3: 可以通过以下语法格式 ...

  10. Linux权限基础

    Linux权限基础 四种权限大类 基本权限 特殊权限 隐藏权限 file ACL权限 三种基本权限 r(read) 读是基本权限,没有读权限其他的一切操作都会被限制 读 4 w(write) 写 2 ...